brospars / simple-calendar

Simple calendar jquery plugin
https://brospars.github.io/simple-calendar
MIT License
49 stars 38 forks source link

Is there provision for times zones? #30

Closed coda-apps closed 3 years ago

coda-apps commented 4 years ago

Eg, if someone is viewing events in the US, there will be at a certain time. but those same events need to appear at different times for someone viewing them in the UK.

Does Simple Cal support this?

Also - is there demo page somewhere to see how the various options work?

Thanks!

brospars commented 4 years ago

I think it does, but I haven't tested it.

If you use ISO string dates for events then the time zone is defined. So I think, someone from a different time zone will see the event relatively to his time zone.

pokhiii commented 4 years ago

Yes, I can confirm that's the case. I sent the dates in ISO format and when the dates are displayed they are in the local format.

@brospars: Is there a way to do the opposite, i.e, can I enforce the calendar in a timezone of my choice?

For instance, in the backend, the timezone setting is US/Eastern. I convert the time in ISO format and send it to the calendar. The calendar is shown in the Indian Standard Time timezone (because I'm accessing it from India). I don't want that. Irrespective of the location of the user, I'd want to have calendar formed in US/Eastern timezone.

brospars commented 4 years ago

There is no way of forcing a timezone in javascript.

However if you don't include timezone in the ISO string date then it's interpreted in you local time (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse#Date_Time_String_Format). So it will be the same for everyone whatever their timezone.

Demo : https://jsfiddle.net/fe0ug3bn/1/

brospars commented 3 years ago

Closing since no response.