Site logo

[Resolved] Show PDT On Articles During DST and PST Outside It

Home Forums Support [Resolved] Show PDT On Articles During DST and PST Outside It

Home Forums Support Show PDT On Articles During DST and PST Outside It

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #2570456
    Jordan Levi

    hey, so i want my website to show the timezone next to the day and time articles were posted and i finally figured out how to throw PST next to them, but i realized that we’re actually in PDT now, so is there a way to keep the PST next to articles when they’re posted outside of daylights savings and PDT next to articles when they’re posted during it?

    #2570487
    Fernando
    Customer Support

    Hi Jordan,

    How are you adding the Timezone currently?

    You’ll likely need a custom code for this.

    #2570504
    Jordan Levi

    i checked ‘Custom’ under Date Format in the general settings tab and put this in the box: F j, Y \a\t g:i A \P\S\T\

    #2570569
    Fernando
    Customer Support

    I see. It’s a bit complicated and would be out of our scope of support.

    Someone shared this code:

    wp_add_inline_script(
    	'wp-date',
    	implode(
    		"\n",
    		array(
    			'var localDateSettings = wp.date.__experimentalGetSettings();',
    			'localDateSettings.formats.datetimeAbbreviated = "M j, Y g:i a T";',
    			'wp.date.setSettings(localDateSettings);',
    		)
    	),
    	'after'
    );

    Adding PHP: https://docs.generatepress.com/article/adding-php/#code-snippets

    You can then try adding this to your date Format: Y/m/d g:i a T

    Not sure if it would work. It might be good to reach out to a developer regarding this.

    #2571238
    Jordan Levi

    hell yeah, it worked, thank you so much!

    #2573443
    Fernando
    Customer Support

    You’re welcome, Jordan!

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.