Setting default UTC Timezone to match NYC timezone
git submodule update (for cac-site-templates)
Would it make sense to set to the daulty UTC timezone to match the NYC timezone (currently UTC -5)?
I noticed today and several times before when creating posts, it will say they were created 5-6 ahead. I can see how this might create issues if professors have due dates set for midnight.
I imagine that setting the default timezone to match NYC would make sense as a default for most CUNY classes. What do you all think?
Tested default here: https://testingdefaultutc.commons.gc.cuny.edu/wp-admin/options-general.php
Updated by Boone Gorges 4 months ago
- Assignee set to Jeremy Felt
Laurie, I agree that this is a good idea.
It seems like a similar feature was requested long ago in WordPress, but the answer was "do it with a filter". https://core.trac.wordpress.org/ticket/25345 However, there are, as far as I can tell, no filters that will allow you to do this. See eg
wp_initialize_site(). I think what we need instead is a callback for
'wp_initialize_site' (later than 10, which is where the
wp_initialize_site() function runs) that sets the gmt_offset and timezone_string options. Jeremy, would you mind confirming this analysis and writing the necessary code?
Updated by Jeremy Felt 3 months ago
Two bits to this:
1. On the CAC repo, the fix/set-default-timezone branch uses the
wp_initialize_site_args filter to set the default
timezone_string option for all new sites to America/New York.
2. On the CAC site templates repo, the fix/preserve-time-zone branc adds
timezone_string to the list of options ignored when "cloning" new sites from site templates.
This feels better than re-updating the option after the fact.