Date field is always 1 day ahead

default discord avatar
generator101
3 months ago
5

I setup a published date for custom published date:



name: 'postedDate',
type: 'date',


but this date is always 1 day ahead in the api return value.



For example, I select

05/09/2023

and this is what is returned in the api

2023-05-10T02:58:59.000Z

. I assumed this is with the timezone? is it possible to just output the exact date selected in the date picker so I dont have to deal with different times?

  • default discord avatar
    donfabrizio
    3 months ago

    Is it a local or hosted setup? Isn't it the settings of you machine that has an issue?

  • default discord avatar
    generator101
    3 months ago

    It is on local, I am not sure, I would think if I select May 9 from the date picker, the date it would return in the api would be May 9 as well but it is returning May 10

  • discord user avatar
    denolfe
    Payload Team
    2 months ago

    Is it possible this is the ISO date timezone conversion?

  • default discord avatar
    generator101
    2 months ago

    Yeah, i had to convert the date in frontend, it is not possible to set a default time zone for the api?

  • discord user avatar
    denolfe
    Payload Team
    2 months ago

    Not currently. Most advice would be to always store ISO date and convert wherever it is presented.

Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!

Star

Connect with the Payload Community on Discord

Discord

online

Can't find what you're looking for?

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