Previous CloneSet | Next CloneSet | Back to Main Report |
Clone Mass | Clones in CloneSet | Parameter Count | Clone Similarity | Syntax Category [Sequence Length] |
---|---|---|---|---|
4 | 2 | 1 | 0.989 | ExpressionStatement |
Clone Abstraction | Parameter Bindings |
Clone Instance (Click to see clone) | Line Count | Source Line | Source File |
---|---|---|---|
1 | 4 | 105 | Closure/closure/goog/locale/datetimeformat.js |
2 | 4 | 137 | Closure/closure/goog/locale/datetimeparse.js |
| ||||
/** * DateTime formatting functions following the pattern specification as defined * in JDK, ICU and CLDR, with minor modification for typical usage in JS. * Pattern specification: (Refer to JDK/ICU/CLDR) * <pre> * Symbol Meaning Presentation Example * ------ ------- ------------ ------- * G era designator (Text) AD * y# year (Number) 1996 * Y* year (week of year) (Number) 1997 * u* extended year (Number) 4601 * M month in year (Text & Number) July & 07 * d day in month (Number) 10 * h hour in am/pm (1~12) (Number) 12 * H hour in day (0~23) (Number) 0 * m minute in hour (Number) 30 * s second in minute (Number) 55 * S fractional second (Number) 978 * E day of week (Text) Tuesday * e* day of week (local 1~7) (Number) 2 * D* day in year (Number) 189 * F* day of week in month (Number) 2 (2nd Wed in July) * w* week in year (Number) 27 * W* week in month (Number) 2 * a am/pm marker (Text) PM * k hour in day (1~24) (Number) 24 * K hour in am/pm (0~11) (Number) 0 * z time zone (Text) Pacific Standard Time * Z time zone (RFC 822) (Number) -0800 * v time zone (generic) (Text) Pacific Time * g* Julian day (Number) 2451334 * A* milliseconds in day (Number) 69540000 * ' escape for text (Delimiter) 'Date=' * '' single quote (Literal) 'o''clock' * * Item marked with '*' are not supported yet. * Item marked with '#' works different than java * * The count of pattern letters determine the format. * (Text): 4 or more, use full form, <4, use short or abbreviated form if it * exists. (e.g., "EEEE" produces "Monday", "EEE" produces "Mon") * * (Number): the minimum number of digits. Shorter numbers are zero-padded to * this amount (e.g. if "m" produces "6", "mm" produces "06"). Year is handled * specially; that is, if the count of 'y' is 2, the Year will be truncated to * 2 digits. (e.g., if "yyyy" produces "1997", "yy" produces "97".) Unlike other * fields, fractional seconds are padded on the right with zero. * * (Text & Number): 3 or over, use text, otherwise use number. (e.g., "M" * produces "1", "MM" produces "01", "MMM" produces "Jan", and "MMMM" produces * "January".) * * Any characters in the pattern that are not in the ranges of ['a'..'z'] and * ['A'..'Z'] will be treated as quoted text. For instance, characters like ':', * '.', ' ', '#' and '@' will appear in the resulting time text even they are * not embraced within single quotes. * </pre> */ /** * Construct a DateTimeFormat object based on current locale. * @constructor * @deprecated Use goog.i18n.DateTimeFormat. */ goog.locale.DateTimeFormat= function ( ) { this.symbols_= goog.locale.getResource('DateTimeConstants', goog.locale.getLocale( )); this.patternParts_= [ ]; } ; |
| ||||
/** * DateTimeParse is for parsing date in a locale-sensitive manner. It allows * user to use any customized patterns to parse date-time string under certain * locale. Things varies across locales like month name, weekname, field * order, etc. * * This module is the counter-part of DateTimeFormat. They use the same * date/time pattern specification, which is borrowed from ICU/JDK. * * This implementation could parse partial date/time. * * Time Format Syntax: To specify the time format use a time pattern string. * In this pattern, following letters are reserved as pattern letters, which * are defined as the following: * * <pre> * Symbol Meaning Presentation Example * ------ ------- ------------ ------- * G era designator (Text) AD * y# year (Number) 1996 * M month in year (Text & Number) July & 07 * d day in month (Number) 10 * h hour in am/pm (1~12) (Number) 12 * H hour in day (0~23) (Number) 0 * m minute in hour (Number) 30 * s second in minute (Number) 55 * S fractional second (Number) 978 * E day of week (Text) Tuesday * D day in year (Number) 189 * a am/pm marker (Text) PM * k hour in day (1~24) (Number) 24 * K hour in am/pm (0~11) (Number) 0 * z time zone (Text) Pacific Standard Time * Z time zone (RFC 822) (Number) -0800 * v time zone (generic) (Text) Pacific Time * ' escape for text (Delimiter) 'Date=' * '' single quote (Literal) 'o''clock' * </pre> * * The count of pattern letters determine the format. <p> * (Text): 4 or more pattern letters--use full form, * less than 4--use short or abbreviated form if one exists. * In parsing, we will always try long format, then short. <p> * (Number): the minimum number of digits. <p> * (Text & Number): 3 or over, use text, otherwise use number. <p> * Any characters that not in the pattern will be treated as quoted text. For * instance, characters like ':', '.', ' ', '#' and '@' will appear in the * resulting time text even they are not embraced within single quotes. In our * current pattern usage, we didn't use up all letters. But those unused * letters are strongly discouraged to be used as quoted text without quote. * That's because we may use other letter for pattern in future. <p> * * Examples Using the US Locale: * * Format Pattern Result * -------------- ------- * "yyyy.MM.dd G 'at' HH:mm:ss vvvv" ->> 1996.07.10 AD at 15:08:56 Pacific Time * "EEE, MMM d, ''yy" ->> Wed, July 10, '96 * "h:mm a" ->> 12:08 PM * "hh 'o''clock' a, zzzz" ->> 12 o'clock PM, Pacific Daylight Time * "K:mm a, vvv" ->> 0:00 PM, PT * "yyyyy.MMMMM.dd GGG hh:mm aaa" ->> 01996.July.10 AD 12:08 PM * * <p> When parsing a date string using the abbreviated year pattern ("yy"), * DateTimeParse must interpret the abbreviated year relative to some * century. It does this by adjusting dates to be within 80 years before and 20 * years after the time the parse function is called. For example, using a * pattern of "MM/dd/yy" and a DateTimeParse instance created on Jan 1, 1997, * the string "01/11/12" would be interpreted as Jan 11, 2012 while the string * "05/04/64" would be interpreted as May 4, 1964. During parsing, only * strings consisting of exactly two digits, as defined by {@link * java.lang.Character#isDigit(char)}, will be parsed into the default * century. Any other numeric string, such as a one digit string, a three or * more digit string will be interpreted as its face value. * * <p> If the year pattern does not have exactly two 'y' characters, the year is * interpreted literally, regardless of the number of digits. So using the * pattern "MM/dd/yyyy", "01/11/12" parses to Jan 11, 12 A.D. * * <p> When numeric fields abut one another directly, with no intervening * delimiter characters, they constitute a run of abutting numeric fields. Such * runs are parsed specially. For example, the format "HHmmss" parses the input * text "123456" to 12:34:56, parses the input text "12345" to 1:23:45, and * fails to parse "1234". In other words, the leftmost field of the run is * flexible, while the others keep a fixed width. If the parse fails anywhere in * the run, then the leftmost field is shortened by one character, and the * entire run is parsed again. This is repeated until either the parse succeeds * or the leftmost field is one character in length. If the parse still fails at * that point, the parse of the run fails. * * <p> Now timezone parsing only support GMT:hhmm, GMT:+hhmm, GMT:-hhmm */ /** * Construct a DateTimeParse based on current locale. * @constructor * @deprecated Use goog.i18n.DateTimeParse. */ goog.locale.DateTimeParse= function ( ) { this.symbols_= goog.locale.getResource('DateTimeConstants', goog.locale.getLocale( )); this.patternParts_= [ ]; } ; |
| |||
/** * DateTime formatting functions following the pattern specification as defined * in JDK, ICU and CLDR, with minor modification for typical usage in JS. * Pattern specification: (Refer to JDK/ICU/CLDR) * <pre> * Symbol Meaning Presentation Example * ------ ------- ------------ ------- * G era designator (Text) AD * y# year (Number) 1996 * Y* year (week of year) (Number) 1997 * u* extended year (Number) 4601 * M month in year (Text & Number) July & 07 * d day in month (Number) 10 * h hour in am/pm (1~12) (Number) 12 * H hour in day (0~23) (Number) 0 * m minute in hour (Number) 30 * s second in minute (Number) 55 * S fractional second (Number) 978 * E day of week (Text) Tuesday * e* day of week (local 1~7) (Number) 2 * D* day in year (Number) 189 * F* day of week in month (Number) 2 (2nd Wed in July) * w* week in year (Number) 27 * W* week in month (Number) 2 * a am/pm marker (Text) PM * k hour in day (1~24) (Number) 24 * K hour in am/pm (0~11) (Number) 0 * z time zone (Text) Pacific Standard Time * Z time zone (RFC 822) (Number) -0800 * v time zone (generic) (Text) Pacific Time * g* Julian day (Number) 2451334 * A* milliseconds in day (Number) 69540000 * ' escape for text (Delimiter) 'Date=' * '' single quote (Literal) 'o''clock' * * Item marked with '*' are not supported yet. * Item marked with '#' works different than java * * The count of pattern letters determine the format. * (Text): 4 or more, use full form, <4, use short or abbreviated form if it * exists. (e.g., "EEEE" produces "Monday", "EEE" produces "Mon") * * (Number): the minimum number of digits. Shorter numbers are zero-padded to * this amount (e.g. if "m" produces "6", "mm" produces "06"). Year is handled * specially; that is, if the count of 'y' is 2, the Year will be truncated to * 2 digits. (e.g., if "yyyy" produces "1997", "yy" produces "97".) Unlike other * fields, fractional seconds are padded on the right with zero. * * (Text & Number): 3 or over, use text, otherwise use number. (e.g., "M" * produces "1", "MM" produces "01", "MMM" produces "Jan", and "MMMM" produces * "January".) * * Any characters in the pattern that are not in the ranges of ['a'..'z'] and * ['A'..'Z'] will be treated as quoted text. For instance, characters like ':', * '.', ' ', '#' and '@' will appear in the resulting time text even they are * not embraced within single quotes. * </pre> */ /** * Construct a DateTimeFormat object based on current locale. * @constructor * @deprecated Use goog.i18n.DateTimeFormat. */ /** * DateTimeParse is for parsing date in a locale-sensitive manner. It allows * user to use any customized patterns to parse date-time string under certain * locale. Things varies across locales like month name, weekname, field * order, etc. * * This module is the counter-part of DateTimeFormat. They use the same * date/time pattern specification, which is borrowed from ICU/JDK. * * This implementation could parse partial date/time. * * Time Format Syntax: To specify the time format use a time pattern string. * In this pattern, following letters are reserved as pattern letters, which * are defined as the following: * * <pre> * Symbol Meaning Presentation Example * ------ ------- ------------ ------- * G era designator (Text) AD * y# year (Number) 1996 * M month in year (Text & Number) July & 07 * d day in month (Number) 10 * h hour in am/pm (1~12) (Number) 12 * H hour in day (0~23) (Number) 0 * m minute in hour (Number) 30 * s second in minute (Number) 55 * S fractional second (Number) 978 * E day of week (Text) Tuesday * D day in year (Number) 189 * a am/pm marker (Text) PM * k hour in day (1~24) (Number) 24 * K hour in am/pm (0~11) (Number) 0 * z time zone (Text) Pacific Standard Time * Z time zone (RFC 822) (Number) -0800 * v time zone (generic) (Text) Pacific Time * ' escape for text (Delimiter) 'Date=' * '' single quote (Literal) 'o''clock' * </pre> * * The count of pattern letters determine the format. <p> * (Text): 4 or more pattern letters--use full form, * less than 4--use short or abbreviated form if one exists. * In parsing, we will always try long format, then short. <p> * (Number): the minimum number of digits. <p> * (Text & Number): 3 or over, use text, otherwise use number. <p> * Any characters that not in the pattern will be treated as quoted text. For * instance, characters like ':', '.', ' ', '#' and '@' will appear in the * resulting time text even they are not embraced within single quotes. In our * current pattern usage, we didn't use up all letters. But those unused * letters are strongly discouraged to be used as quoted text without quote. * That's because we may use other letter for pattern in future. <p> * * Examples Using the US Locale: * * Format Pattern Result * -------------- ------- * "yyyy.MM.dd G 'at' HH:mm:ss vvvv" ->> 1996.07.10 AD at 15:08:56 Pacific Time * "EEE, MMM d, ''yy" ->> Wed, July 10, '96 * "h:mm a" ->> 12:08 PM * "hh 'o''clock' a, zzzz" ->> 12 o'clock PM, Pacific Daylight Time * "K:mm a, vvv" ->> 0:00 PM, PT * "yyyyy.MMMMM.dd GGG hh:mm aaa" ->> 01996.July.10 AD 12:08 PM * * <p> When parsing a date string using the abbreviated year pattern ("yy"), * DateTimeParse must interpret the abbreviated year relative to some * century. It does this by adjusting dates to be within 80 years before and 20 * years after the time the parse function is called. For example, using a * pattern of "MM/dd/yy" and a DateTimeParse instance created on Jan 1, 1997, * the string "01/11/12" would be interpreted as Jan 11, 2012 while the string * "05/04/64" would be interpreted as May 4, 1964. During parsing, only * strings consisting of exactly two digits, as defined by {@link * java.lang.Character#isDigit(char)}, will be parsed into the default * century. Any other numeric string, such as a one digit string, a three or * more digit string will be interpreted as its face value. * * <p> If the year pattern does not have exactly two 'y' characters, the year is * interpreted literally, regardless of the number of digits. So using the * pattern "MM/dd/yyyy", "01/11/12" parses to Jan 11, 12 A.D. * * <p> When numeric fields abut one another directly, with no intervening * delimiter characters, they constitute a run of abutting numeric fields. Such * runs are parsed specially. For example, the format "HHmmss" parses the input * text "123456" to 12:34:56, parses the input text "12345" to 1:23:45, and * fails to parse "1234". In other words, the leftmost field of the run is * flexible, while the others keep a fixed width. If the parse fails anywhere in * the run, then the leftmost field is shortened by one character, and the * entire run is parsed again. This is repeated until either the parse succeeds * or the leftmost field is one character in length. If the parse still fails at * that point, the parse of the run fails. * * <p> Now timezone parsing only support GMT:hhmm, GMT:+hhmm, GMT:-hhmm */ /** * Construct a DateTimeParse based on current locale. * @constructor * @deprecated Use goog.i18n.DateTimeParse. */ goog.locale. [[#variable21116040]]= function ( ) { this.symbols_=goog.locale.getResource('DateTimeConstants',goog.locale.getLocale( )); this.patternParts_=[ ]; } ; |
CloneAbstraction |
Parameter Index | Clone Instance | Parameter Name | Value |
---|---|---|---|
1 | 1 | [[#21116040]] | DateTimeFormat |
1 | 2 | [[#21116040]] | DateTimeParse |