Project

General

Profile

Actions

Feature #19286

closed

Setting default UTC Timezone to match NYC timezone

Added by Laurie Hurson about 1 year ago. Updated 12 months ago.

Status:
Resolved
Priority name:
Normal
Assignee:
Category name:
-
Target version:
Start date:
2023-11-16
Due date:
% Done:

0%

Estimated time:
Deployment actions:

git submodule update (for cac-site-templates)


Description

Hi All,

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
See screenshot.


Files

Actions #1

Updated by Boone Gorges about 1 year 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 populate_options(), 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?

Actions #2

Updated by Laurie Hurson about 1 year ago

This sounds good to me!

Thanks Boone and Jeremy!

Actions #3

Updated by Boone Gorges 12 months ago

  • Target version set to 2.2.4
Actions #4

Updated by Jeremy Felt 12 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.

Actions #5

Updated by Boone Gorges 12 months ago

  • Status changed from New to Staged for Production Release
  • Deployment actions updated (diff)

Looks like the right strategy, Jeremy. Thanks!

I've merged branches and pinned the commit for cac-site-templates.

Actions #6

Updated by Boone Gorges 12 months ago

  • Status changed from Staged for Production Release to Resolved
Actions

Also available in: Atom PDF