MilitaryTimeZone.js 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. // See: https://github.com/Microsoft/ChakraCore/pull/4016
  6. // Test interpretation of military time zone
  7. runTest("2011-11-08 19:48:43a", "2011-11-08T19:48:43.000+01:00");
  8. runTest("2011-11-08 19:48:43 a", "2011-11-08T19:48:43.000+01:00");
  9. runTest("2011-11-08 19:48:43 b", "2011-11-08T19:48:43.000+02:00");
  10. runTest("2011-11-08 19:48:43 c", "2011-11-08T19:48:43.000+03:00");
  11. runTest("2011-11-08 19:48:43 d", "2011-11-08T19:48:43.000+04:00");
  12. runTest("2011-11-08 19:48:43 e", "2011-11-08T19:48:43.000+05:00");
  13. runTest("2011-11-08 19:48:43 f", "2011-11-08T19:48:43.000+06:00");
  14. runTest("2011-11-08 19:48:43 g", "2011-11-08T19:48:43.000+07:00");
  15. runTest("2011-11-08 19:48:43 h", "2011-11-08T19:48:43.000+08:00");
  16. runTest("2011-11-08 19:48:43 i", "2011-11-08T19:48:43.000+09:00");
  17. runTest("2011-11-08 19:48:43 j", null);
  18. runTest("2011-11-08 19:48:43 k", "2011-11-08T19:48:43.000+10:00");
  19. runTest("2011-11-08 19:48:43 l", "2011-11-08T19:48:43.000+11:00");
  20. runTest("2011-11-08 19:48:43 m", "2011-11-08T19:48:43.000+12:00");
  21. runTest("2011-11-08 19:48:43 n", "2011-11-08T19:48:43.000-01:00");
  22. runTest("2011-11-08 19:48:43 o", "2011-11-08T19:48:43.000-02:00");
  23. runTest("2011-11-08 19:48:43 p", "2011-11-08T19:48:43.000-03:00");
  24. runTest("2011-11-08 19:48:43 q", "2011-11-08T19:48:43.000-04:00");
  25. runTest("2011-11-08 19:48:43 r", "2011-11-08T19:48:43.000-05:00");
  26. runTest("2011-11-08 19:48:43 s", "2011-11-08T19:48:43.000-06:00");
  27. runTest("2011-11-08 19:48:43 t", "2011-11-08T19:48:43.000-07:00");
  28. runTest("2011-11-08 19:48:43 u", "2011-11-08T19:48:43.000-08:00");
  29. runTest("2011-11-08 19:48:43 v", "2011-11-08T19:48:43.000-09:00");
  30. runTest("2011-11-08 19:48:43 w", "2011-11-08T19:48:43.000-10:00");
  31. runTest("2011-11-08 19:48:43 x", "2011-11-08T19:48:43.000-11:00");
  32. runTest("2011-11-08 19:48:43 y", "2011-11-08T19:48:43.000-12:00");
  33. runTest("2011-11-08 19:48:43 z", "2011-11-08T19:48:43.000Z");
  34. function runTest(dateToTest, isoDate) {
  35. if (isoDate === null) {
  36. if (isNaN(Date.parse(dateToTest))) {
  37. console.log("PASS");
  38. } else {
  39. console.log("Wrong date parsing result: Date.parse(\"" + dateToTest + "\") should return NaN");
  40. }
  41. } else {
  42. if (Date.parse(dateToTest) === Date.parse(isoDate)) {
  43. console.log("PASS");
  44. } else {
  45. console.log("Wrong date parsing result: Date.parse(\"" + dateToTest + "\") should equal Date.parse(\"" + isoDate + "\")");
  46. }
  47. }
  48. }