You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There doesn't seem to be a way to override the default Date object, while setting the timezone without breaking handling of invalid dates.
The default Date object returns "Invalid Date" for new Date(NaN). Babel's ES6 transpiler does the test (new Date(NaN) + '') == 'Invalid Date', which fails with node-time's extended Date.
> new time.Date(NaN) + ''
TypeError: Cannot read property 'substring' of undefined
at Date.toDateString (/Users/user/node_modules/time/index.js:471:39)
at Date.toString (/Users/user/node_modules/time/index.js:484:17)
at repl:1:20
at REPLServer.defaultEval (repl.js:252:27)
at bound (domain.js:287:14)
at REPLServer.runBound [as eval] (domain.js:300:12)
at REPLServer.<anonymous> (repl.js:417:12)
(new time.Date(NaN)).toString() gives the same error.
This seems to work when extending the default Date object, but then it breaks setting the timezone using time.tzset:
> var time = require('time')
> new Date()
Thu Mar 31 2016 21:54:15 GMT-0700 (PDT)
> time.tzset('America/New_York')
{ tzname: [ 'EST', 'EDT' ], timezone: 18000, daylight: 1 }
> time(Date)
> new Date()
Thu Mar 31 2016 21:54:36 GMT-0700 (EDT)
> new Date(NaN)
Invalid Date
The text was updated successfully, but these errors were encountered:
cfal
changed the title
Invalid time handling
Invalid date handling
Apr 1, 2016
There doesn't seem to be a way to override the default Date object, while setting the timezone without breaking handling of invalid dates.
The default Date object returns "Invalid Date" for new Date(NaN). Babel's ES6 transpiler does the test (new Date(NaN) + '') == 'Invalid Date', which fails with node-time's extended Date.
(new time.Date(NaN)).toString() gives the same error.
This seems to work when extending the default Date object, but then it breaks setting the timezone using time.tzset:
The text was updated successfully, but these errors were encountered: