Date / Timestamp & Timezone issue with in-app node.js set up

Feature(s) impacted

widget: “Date Picker”
type: “Date”

Observed behavior

I aim to save a date in my database with the UTC+0 format and subsequently exhibit the same date in a format such as UTC+N, contingent on the user’s location. Currently, I can solely store and exhibit the date in the same format.

Expected behavior

It would be advantageous to store a date in UTC+0 and later exhibit it in the frontend with a format that adjusts to UTC+N, considering the user’s timezone.

  • Project name: Pianity - Forest Admin

  • Team name: Operations

  • Environment name: Development

  • Agent (forest package) name & version:
    @forestadmin/datasource-sql”: “^1.7.39”,
    @forestadmin/datasource-toolkit”: “^1.29.0”,

  • Database type: postgre

Hello @Tim_0123

Welcome on the Forest community, and thank you for reaching out.

Can you please elaborate a bit more on your use case ?

Do you want to display the date on the user’s timezone inside a smart action ?



Thank you for reaching out. I’m encountering an issue with the selected date from the date picker. It seems that the time of the date I input does not match the time in the output.

For instance, I’m using a smart action to update a delivery date. When I input the new date as the 15th of November at 10 am (using the Date type), the modified records reflect the date as 15th of November at 8 am.

Is it feasible to ensure the input and output dates remain consistent?

I appreciate your assistance.

Best regards,

Hello @Tim_0123, thanks for the details.

First, you have to know that the date picker widget for smart actions is timezone aware.
Your smart action should send the date value as UTC equivalent

However, from the execute method of your smart action, you should be able to retrieve the timezone of the caller (the user who executed the smart action)

    execute: async (actionContext, resultBuilder) => {
        const userTimeZone = actionContext.caller.timezone;

Then use this information when storing your date in the rest of the action execution, by using some kind of timezone aware date format.

Then the frontend should be able to use the timezone info to display back the correct date/time to the user.

1 Like

Hello @Nicolas.M,

Thanks for the help. My words might lack clarity. I don’t aim to store the user’s timezone but rather to have the dates displayed in Forest Admin tables based on the client’s timezone which is currently not the case.


Hello @Tim_0123

Ok, I might have misread your question.
Did you use a Date display widget for the column that you wish to show ?
I just tested on my side and it gives the correct timezoned date:

here the first one is Date display widget, and the second one is a plain text