Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

Date field is always 1 day ahead

default discord avatar
generator1012 years 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
    otomorohq2 years ago

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

  • default discord avatar
    generator1012 years 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
    2 years ago

    Is it possible this is the ISO date timezone conversion?

  • default discord avatar
    generator1012 years 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
    2 years ago

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

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.