News for hackers. Stuff that matters.
Re:JavaScript's “new Date()” causing 90% of Alibaba's intern... by draw_down on Wednesday February 10, 2016 @04:25PM (#11076129)
Yes. But front-end JS takes it to the next level by, for example, not providing any sane way to get the current locale.
Re:JavaScript's “new Date()” causing 90% of Alibaba's intern... by xlm1717 on Wednesday February 10, 2016 @04:59PM (#11076413)
Just don't do it on the front-end. Never do it on the front-end.
Re:JavaScript's “new Date()” causing 90% of Alibaba's intern... by draw_down on Wednesday February 10, 2016 @05:47PM (#11076785)
You have to. User specifies thing should happen at 2PM, their time, then POSTs that data to your API or whatever. Well, what time are they actually talking about? You need to know.
Re:JavaScript's “new Date()” causing 90% of Alibaba's intern... by toomuchtodo on Wednesday February 10, 2016 @08:03PM (#11077531)
You ask the user what time zone they're in? Better to have accurate data then guess.
Re:JavaScript's “new Date()” causing 90% of Alibaba's intern... by redrummr on Thursday February 11, 2016 @02:19AM (#11078696)
Especially considering this is consistent with not identifying the device beyond headers sent etc. and you can't just use an IP address to map the timezone as it may be shared at the tower/exchange kilometres away (DSL) or hundreds of kilometres away (wireless/cell) and cross timezones.

The best strategy is to suggest the [timezone|local shop|city name|whatever] and prompt for confirmation.

Re:JavaScript's “new Date()” causing 90% of Alibaba's intern... by douche on Wednesday February 10, 2016 @05:42PM (#11076750)
Moment.js is a must-have.
Re:JavaScript's “new Date()” causing 90% of Alibaba's intern... by nstr007 on Wednesday February 10, 2016 @06:11PM (#11076976)
If only we didn't need to add so much to our payload just to handle dates.
Re:JavaScript's “new Date()” causing 90% of Alibaba's intern... by ErikAugust on Wednesday February 10, 2016 @10:06PM (#11077982)
getTimezoneOffset()