Setting default time zone

default discord avatar
nlvogel12 months ago
3

Is there a way to set my preferred time zone for date fields?

  • default discord avatar
    samy728812 months ago

    Yes you can. According to the documentation you can you can set the

    localized

    attribute to

    true

    Here's the link of the screenshot :

    https://payloadcms.com/docs/fields/date#config

    Here's the link of the localization enable in the base config :


    https://payloadcms.com/docs/configuration/localization
    image.png
  • default discord avatar
    nlvogel12 months ago

    @Sam thank you!

  • default discord avatar
    ingrid7413 months ago

    Couldn't find anything about it in the Docs. Switching on localization on the field doesn't change the date picker or set Time Zone on it.



    Date is stored as the Docs say YYYY-MM-DDTHH:mm:ss.SSSZ (e.g. 1999-01-01T8:00:00.000+05:00) but the time zone part is always +00:00 unless I missed a meeting 🙏



    The datetime stored in database is correct, it's just stored in UTC (without offset) so front ends can get Time Zone from their user and display it accordingly

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.