urish / angular-moment

Moment.JS directives for Angular.JS (timeago and more)
MIT License
2.6k stars 397 forks source link

Time zone issue. #193

Closed m-saifuddin closed 8 years ago

m-saifuddin commented 8 years ago

I am facing an issue in converting datetime in current timzone. I am receiving a date in string format from server "2015-10-09T08:00:00" which is Central Time.

I used is to convert by adding timezone offset and its returning me right result but defiantly failed when daylight saving activated.

[code] date = '2015-10-10T08:00:00'+'-06:00'; new Date(date)// print me below Sat Oct 10 2015 19:00:00 GMT+0500 (PKT) [/code]

I appreciated if you suggest me right way to convert it using angular-moment library to handle daylight saving for time conversion.

Thanks,

urish commented 8 years ago

Hi, do you need to convert the timezone within your javascript code or within your html view?

For javascript code, it is better doing directly using the moment library. If you need to convert timezones within your views, take a look at the amTimezone filter included in this library.