OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1360 ldmlString += appendToLDMLString(option, {'2-digit': 'HH', 'numeric': 'H'}); | 1360 ldmlString += appendToLDMLString(option, {'2-digit': 'HH', 'numeric': 'H'}); |
1361 } | 1361 } |
1362 | 1362 |
1363 option = getOption('minute', 'string', ['2-digit', 'numeric']); | 1363 option = getOption('minute', 'string', ['2-digit', 'numeric']); |
1364 ldmlString += appendToLDMLString(option, {'2-digit': 'mm', 'numeric': 'm'}); | 1364 ldmlString += appendToLDMLString(option, {'2-digit': 'mm', 'numeric': 'm'}); |
1365 | 1365 |
1366 option = getOption('second', 'string', ['2-digit', 'numeric']); | 1366 option = getOption('second', 'string', ['2-digit', 'numeric']); |
1367 ldmlString += appendToLDMLString(option, {'2-digit': 'ss', 'numeric': 's'}); | 1367 ldmlString += appendToLDMLString(option, {'2-digit': 'ss', 'numeric': 's'}); |
1368 | 1368 |
1369 option = getOption('timeZoneName', 'string', ['short', 'long']); | 1369 option = getOption('timeZoneName', 'string', ['short', 'long']); |
1370 ldmlString += appendToLDMLString(option, {short: 'v', long: 'vv'}); | 1370 ldmlString += appendToLDMLString(option, {short: 'z', long: 'zzzz'}); |
1371 | 1371 |
1372 return ldmlString; | 1372 return ldmlString; |
1373 } | 1373 } |
1374 | 1374 |
1375 | 1375 |
1376 /** | 1376 /** |
1377 * Returns either LDML equivalent of the current option or empty string. | 1377 * Returns either LDML equivalent of the current option or empty string. |
1378 */ | 1378 */ |
1379 function appendToLDMLString(option, pairs) { | 1379 function appendToLDMLString(option, pairs) { |
1380 if (option !== undefined) { | 1380 if (option !== undefined) { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1433 options, 'hour', match, {H: 'numeric', HH: '2-digit'}); | 1433 options, 'hour', match, {H: 'numeric', HH: '2-digit'}); |
1434 | 1434 |
1435 match = ldmlString.match(/m{1,2}/g); | 1435 match = ldmlString.match(/m{1,2}/g); |
1436 options = appendToDateTimeObject( | 1436 options = appendToDateTimeObject( |
1437 options, 'minute', match, {m: 'numeric', mm: '2-digit'}); | 1437 options, 'minute', match, {m: 'numeric', mm: '2-digit'}); |
1438 | 1438 |
1439 match = ldmlString.match(/s{1,2}/g); | 1439 match = ldmlString.match(/s{1,2}/g); |
1440 options = appendToDateTimeObject( | 1440 options = appendToDateTimeObject( |
1441 options, 'second', match, {s: 'numeric', ss: '2-digit'}); | 1441 options, 'second', match, {s: 'numeric', ss: '2-digit'}); |
1442 | 1442 |
1443 match = ldmlString.match(/v{1,2}/g); | 1443 match = ldmlString.match(/z|zzzz/g); |
1444 options = appendToDateTimeObject( | 1444 options = appendToDateTimeObject( |
1445 options, 'timeZoneName', match, {v: 'short', vv: 'long'}); | 1445 options, 'timeZoneName', match, {z: 'short', zzzz: 'long'}); |
1446 | 1446 |
1447 return options; | 1447 return options; |
1448 } | 1448 } |
1449 | 1449 |
1450 | 1450 |
1451 function appendToDateTimeObject(options, option, match, pairs) { | 1451 function appendToDateTimeObject(options, option, match, pairs) { |
1452 if (match === null) { | 1452 if (match === null) { |
1453 if (!options.hasOwnProperty(option)) { | 1453 if (!options.hasOwnProperty(option)) { |
1454 defineWEProperty(options, option, undefined); | 1454 defineWEProperty(options, option, undefined); |
1455 } | 1455 } |
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2107 writable: true, | 2107 writable: true, |
2108 configurable: true, | 2108 configurable: true, |
2109 enumerable: false | 2109 enumerable: false |
2110 }); | 2110 }); |
2111 %FunctionSetName($Date.prototype.toLocaleTimeString, 'toLocaleTimeString'); | 2111 %FunctionSetName($Date.prototype.toLocaleTimeString, 'toLocaleTimeString'); |
2112 %FunctionRemovePrototype($Date.prototype.toLocaleTimeString); | 2112 %FunctionRemovePrototype($Date.prototype.toLocaleTimeString); |
2113 %SetNativeFlag($Date.prototype.toLocaleTimeString); | 2113 %SetNativeFlag($Date.prototype.toLocaleTimeString); |
2114 | 2114 |
2115 return Intl; | 2115 return Intl; |
2116 }())}); | 2116 }())}); |
OLD | NEW |