toISO_3.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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. runTest(new Date(-3260000000000000));
  6. runTest(new Date(-860000000000000));
  7. runTest(new Date(-62167219200001));
  8. runTest(new Date(3260000000000000));
  9. runTest(new Date(860000000000000));
  10. runTest(new Date(-61167219200001));
  11. runTest(new Date(-62140000000000));
  12. function runTest(d)
  13. {
  14. writeLine(d.toISOString());
  15. writeLine(d.toJSON());
  16. }
  17. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  18. // Helpers
  19. function writeLine(str)
  20. {
  21. WScript.Echo("" + str);
  22. }
  23. function safeCall(func)
  24. {
  25. try
  26. {
  27. return func();
  28. }
  29. catch (ex)
  30. {
  31. writeLine(ex.name + ": " + ex.message);
  32. }
  33. }