arshaw / xdate

A Modern JavaScript Date Library

Home Page:http://arshaw.com/xdate/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to use a client's machine Date Time Object instead of GMT +0

razam217 opened this issue · comments

Whenever I try to convert the date string, it changes the time from GMT+5 (Pakistan Time) to GMT+0, how can I disable this functionality, so that it wouldn't change the time before and after the conversion.

This date:
Sun Jan 25 2015 00:40:00 GMT+0500 (Pakistan Standard Time)
Sun Jan 25 2015 01:35:00 GMT+0500 (Pakistan Standard Time)

is converted to this date:
2015-01-24T20:35:00.000Z
2015-01-24T19:40:00.000Z

commented

@razam217 , About the toJSON, The timezone is always zero UTC offset, as denoted by the suffix "Z". as metioned here https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString

Maybe this one could help:
https://github.com/mde/timezone-js