-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for Dates, Fix bug in offset computation for webviews
- Loading branch information
Showing
10 changed files
with
1,042 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,9 @@ | |||
Copyright © 2006–2011 Peter Hosey | |||
All rights reserved. | |||
|
|||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | |||
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | |||
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. | |||
Neither the name of Peter Hosey nor the names of his contributors may be used to endorse or promote products derived from this software without specific prior written permission. | |||
|
|||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Submodule calabash-js
updated
2 files
+6 −1 | CalabashJS/CalabashJSLib/LPWebQuery.m | |
+3 −0 | src/set_text.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,79 @@ | |||
/*LPISO8601DateFormatter.h | |||
* | |||
*Created by Peter Hosey on 2009-04-11. | |||
*Copyright 2009 Peter Hosey. All rights reserved. | |||
*/ | |||
|
|||
#import <Foundation/Foundation.h> | |||
|
|||
/*This class converts dates to and from ISO 8601 strings. A good introduction to ISO 8601: <http://www.cl.cam.ac.uk/~mgk25/iso-time.html> | |||
* | |||
*Parsing can be done strictly, or not. When you parse loosely, leading whitespace is ignored, as is anything after the date. | |||
*The loose parser will return an NSDate for this string: @" \t\r\n\f\t 2006-03-02!!!" | |||
*Leading non-whitespace will not be ignored; the string will be rejected, and nil returned. See the README that came with this addition. | |||
* | |||
*The strict parser will only accept a string if the date is the entire string. The above string would be rejected immediately, solely on these grounds. | |||
*Also, the loose parser provides some extensions that the strict parser doesn't. | |||
*For example, the standard says for "-DDD" (an ordinal date in the implied year) that the logical representation (meaning, hierarchically) would be "--DDD", but because that extra hyphen is "superfluous", it was omitted. | |||
*The loose parser will accept the extra hyphen; the strict parser will not. | |||
*A full list of these extensions is in the README file. | |||
*/ | |||
|
|||
/*The format to either expect or produce. | |||
*Calendar format is YYYY-MM-DD. | |||
*Ordinal format is YYYY-DDD, where DDD ranges from 1 to 366; for example, 2009-32 is 2009-02-01. | |||
*Week format is YYYY-Www-D, where ww ranges from 1 to 53 (the 'W' is literal) and D ranges from 1 to 7; for example, 2009-W05-07. | |||
*/ | |||
enum { | |||
LPISO8601DateFormatCalendar, | |||
LPISO8601DateFormatOrdinal, | |||
LPISO8601DateFormatWeek, | |||
}; | |||
typedef NSUInteger LPISO8601DateFormat; | |||
|
|||
//The default separator for time values. Currently, this is ':'. | |||
extern unichar ISO8601DefaultTimeSeparatorCharacter; | |||
|
|||
@interface LPISO8601DateFormatter: NSFormatter | |||
{ | |||
NSString *lastUsedFormatString; | |||
NSDateFormatter *unparsingFormatter; | |||
|
|||
NSCalendar *parsingCalendar, *unparsingCalendar; | |||
|
|||
NSTimeZone *defaultTimeZone; | |||
LPISO8601DateFormat format; | |||
unichar timeSeparator; | |||
BOOL includeTime; | |||
BOOL parsesStrictly; | |||
} | |||
|
|||
//Call this if you get a memory warning. | |||
+ (void) purgeGlobalCaches; | |||
|
|||
@property(nonatomic, retain) NSTimeZone *defaultTimeZone; | |||
|
|||
#pragma mark Parsing | |||
|
|||
//As a formatter, this object converts strings to dates. | |||
|
|||
@property BOOL parsesStrictly; | |||
|
|||
- (NSDateComponents *) dateComponentsFromString:(NSString *)string; | |||
- (NSDateComponents *) dateComponentsFromString:(NSString *)string timeZone:(out NSTimeZone **)outTimeZone; | |||
- (NSDateComponents *) dateComponentsFromString:(NSString *)string timeZone:(out NSTimeZone **)outTimeZone range:(out NSRange *)outRange; | |||
|
|||
- (NSDate *) dateFromString:(NSString *)string; | |||
- (NSDate *) dateFromString:(NSString *)string timeZone:(out NSTimeZone **)outTimeZone; | |||
- (NSDate *) dateFromString:(NSString *)string timeZone:(out NSTimeZone **)outTimeZone range:(out NSRange *)outRange; | |||
|
|||
#pragma mark Unparsing | |||
|
|||
@property LPISO8601DateFormat format; | |||
@property BOOL includeTime; | |||
@property unichar timeSeparator; | |||
|
|||
- (NSString *) stringFromDate:(NSDate *)date; | |||
- (NSString *) stringFromDate:(NSDate *)date timeZone:(NSTimeZone *)timeZone; | |||
|
|||
@end |
Oops, something went wrong.