Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 494 if ($isNaN(t)) return t; | 494 if ($isNaN(t)) return t; |
| 495 return DateFromTime(t); | 495 return DateFromTime(t); |
| 496 } | 496 } |
| 497 | 497 |
| 498 | 498 |
| 499 %FunctionSetPrototype($Date, new $Date($NaN)); | 499 %FunctionSetPrototype($Date, new $Date($NaN)); |
| 500 | 500 |
| 501 | 501 |
| 502 var WeekDays = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']; | 502 var WeekDays = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']; |
| 503 var Months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oc t', 'Nov', 'Dec']; | 503 var Months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oc t', 'Nov', 'Dec']; |
| 504 | 504 |
|
iposva
2008/10/29 22:59:38
missing new line?
| |
| 505 | |
| 506 function TwoDigitString(value) { | 505 function TwoDigitString(value) { |
| 507 return value < 10 ? "0" + value : "" + value; | 506 return value < 10 ? "0" + value : "" + value; |
| 508 } | 507 } |
| 509 | 508 |
| 510 | 509 |
| 511 function DateString(time) { | 510 function DateString(time) { |
| 512 var YMD = FromJulianDay(Day(time) + kDayZeroInJulianDay); | 511 var YMD = FromJulianDay(Day(time) + kDayZeroInJulianDay); |
| 513 return WeekDays[WeekDay(time)] + ' ' | 512 return WeekDays[WeekDay(time)] + ' ' |
| 514 + Months[YMD.month] + ' ' | 513 + Months[YMD.month] + ' ' |
| 515 + TwoDigitString(YMD.date) + ' ' | 514 + TwoDigitString(YMD.date) + ' ' |
| 516 + YMD.year; | 515 + YMD.year; |
| 517 } | 516 } |
| 518 | 517 |
| 519 | 518 |
| 519 var LongWeekDays = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Fri day', 'Saturday']; | |
| 520 var LongMonths = ['January', 'February', 'March', 'April', 'May', 'June', 'July' , 'August', 'September', 'October', 'November', 'December']; | |
| 521 | |
| 522 | |
| 523 function LongDateString(time) { | |
| 524 var YMD = FromJulianDay(Day(time) + kDayZeroInJulianDay); | |
| 525 return LongWeekDays[WeekDay(time)] + ', ' | |
| 526 + LongMonths[YMD.month] + ' ' | |
| 527 + TwoDigitString(YMD.date) + ', ' | |
| 528 + YMD.year; | |
| 529 } | |
| 530 | |
| 531 | |
| 520 function TimeString(time) { | 532 function TimeString(time) { |
| 521 return TwoDigitString(HourFromTime(time)) + ':' | 533 return TwoDigitString(HourFromTime(time)) + ':' |
| 522 + TwoDigitString(MinFromTime(time)) + ':' | 534 + TwoDigitString(MinFromTime(time)) + ':' |
| 523 + TwoDigitString(SecFromTime(time)); | 535 + TwoDigitString(SecFromTime(time)); |
| 524 } | 536 } |
| 525 | 537 |
| 526 | 538 |
| 527 function LocalTimezoneString(time) { | 539 function LocalTimezoneString(time) { |
| 528 var timezoneOffset = (local_time_offset + DaylightSavingsOffset(time)) / msPer Minute; | 540 var timezoneOffset = (local_time_offset + DaylightSavingsOffset(time)) / msPer Minute; |
| 529 var sign = (timezoneOffset >= 0) ? 1 : -1; | 541 var sign = (timezoneOffset >= 0) ? 1 : -1; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 609 | 621 |
| 610 | 622 |
| 611 // ECMA 262 - 15.9.5.5 | 623 // ECMA 262 - 15.9.5.5 |
| 612 function DateToLocaleString() { | 624 function DateToLocaleString() { |
| 613 return DateToString.call(this); | 625 return DateToString.call(this); |
| 614 } | 626 } |
| 615 | 627 |
| 616 | 628 |
| 617 // ECMA 262 - 15.9.5.6 | 629 // ECMA 262 - 15.9.5.6 |
| 618 function DateToLocaleDateString() { | 630 function DateToLocaleDateString() { |
| 619 return DateToDateString.call(this); | 631 var t = GetTimeFrom(this); |
| 632 if ($isNaN(t)) return kInvalidDate; | |
| 633 return LongDateString(LocalTimeNoCheck(t)); | |
| 620 } | 634 } |
| 621 | 635 |
| 622 | 636 |
| 623 // ECMA 262 - 15.9.5.7 | 637 // ECMA 262 - 15.9.5.7 |
| 624 function DateToLocaleTimeString() { | 638 function DateToLocaleTimeString() { |
| 625 var t = GetTimeFrom(this); | 639 var t = GetTimeFrom(this); |
| 626 if ($isNaN(t)) return kInvalidDate; | 640 if ($isNaN(t)) return kInvalidDate; |
| 627 var lt = LocalTimeNoCheck(t); | 641 var lt = LocalTimeNoCheck(t); |
| 628 return TimeString(lt); | 642 return TimeString(lt); |
| 629 } | 643 } |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1011 "setFullYear", DateSetFullYear, | 1025 "setFullYear", DateSetFullYear, |
| 1012 "setUTCFullYear", DateSetUTCFullYear, | 1026 "setUTCFullYear", DateSetUTCFullYear, |
| 1013 "toGMTString", DateToGMTString, | 1027 "toGMTString", DateToGMTString, |
| 1014 "toUTCString", DateToUTCString, | 1028 "toUTCString", DateToUTCString, |
| 1015 "getYear", DateGetYear, | 1029 "getYear", DateGetYear, |
| 1016 "setYear", DateSetYear | 1030 "setYear", DateSetYear |
| 1017 )); | 1031 )); |
| 1018 } | 1032 } |
| 1019 | 1033 |
| 1020 SetupDate(); | 1034 SetupDate(); |
| OLD | NEW |