localgovdrupal / localgov_workflows

Default editorial workflow for LocalGov Drupal content.
GNU General Public License v2.0
0 stars 1 forks source link

Timezone logic (javascript) #23

Open ekes opened 2 years ago

ekes commented 2 years ago

So the timezone logic here if it is to work outside of UTC / UTC+1 without noticeable quirks:

At the moment Drupal runs date_default_timezone_set() with in order of preference: user timezone, site timezone, system timezone. So consistently using strtotime() - including in the test - with a site timezone set, and no user timezone, should consistently return the expected value.

As soon as a user timezone is thrown into the mix the bets are off; and this is also then the javascript calculation https://github.com/localgovdrupal/localgov_workflows/blob/f1e4f7331fea34e7b3a9b8fdd4d851c09948f337/modules/localgov_review_date/js/review-date.js#L38 of time in the 'testing browser'?

_Originally posted by @ekes in https://github.com/localgovdrupal/localgov_workflows/pull/18#discussion_r725624375_