Reputation: 51
I have this format date:
Sunday 20:30 America/Toronto
i want every time a user access the page with the date to get auto timezone convert that date but i only want to convert and display for example this format Sunday 20:30 .
thanks in advance.
Upvotes: 2
Views: 660
Reputation: 1969
You can you use moment-timezone alongside with timeZoneDetect and this will get the desired behaviour.
For example:
var tz = jstz.determine();
var userTimeZone = tz.name();
//you can use any date format here you want
var currentTime = moment.tz("2014-06-01 12:00", "America/Toronto"); // time defined in Toronto timezone
var userTime = newYork.clone().tz(userTimeZone);
Upvotes: 1