Global Date Handler for javascript
I have a site that uses JavaScript extensively.
But my problem is now that my site is being used by various timezones the date and times are incorrect when displaying data from the server (TZ A) and Displayed on the client using JavaScript (TZ B). My site is ASP.net if that makes any difference.
Originally I never catered for UTC like I should have, sorry my Bad :).
Now I have a problem and I would rather not have to work through all my JavaScript to rectify hundreds of non UTC dates.
So My Question: Is there a global / site wide way I can extend / override or handle converting all my dates from server time to the clients timezone and display the dates that should be shown.
I would like to have one central place that can handle all the date / timezone开发者_开发问答 stuff and not need to be implemented in dozens of different places.
Any Idea or Suggestions are welcome.
Thanks
Can you refactor your source code in JS to replace all Date classes (or whatever you use) with your custom one? Then you could encapsulate all date conversion logic into that new class.
精彩评论