dateBasic.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. var x = new Date();
  6. var y = x;
  7. var z = new Date(2012, 1);
  8. y.foo = 3;
  9. var w = Date.now();
  10. var dinfty = new Date(Infinity);
  11. WScript.SetTimeout(testFunction, 50);
  12. /////////////////
  13. function testFunction()
  14. {
  15. telemetryLog(`x === y: ${x === y}`, true); //true
  16. telemetryLog(`w !== z: ${w !== z.valueOf()}`, true); //true
  17. telemetryLog(`y.foo: ${y.foo}`, true); //3
  18. telemetryLog(`x.foo: ${x.foo}`, true); //3
  19. telemetryLog(`w - z > 0: ${w - z.valueOf() > 0}`, true); //true
  20. telemetryLog(`x - y: ${x.valueOf() - y.valueOf()}`, true); //0
  21. try
  22. {
  23. telemetryLog(dinfty.toISOString(), true);
  24. }
  25. catch(e)
  26. {
  27. telemetryLog(`Infinity Date toISOString : ${e.name} : ${e.message}`, true);
  28. }
  29. telemetryLog(`Infinity Date toJSON : ${dinfty.toJSON()}`, true);
  30. emitTTDLog(ttdLogURI);
  31. }