What type of field are you storing the the value to? Datetime?
How do you store it, at database level or via wappler insert/ update action
Where is your sever located
Because NodeJS/Knex applies ‘Z’ to the no-timezone date-time values returned from the DB server, when you apply date formatter on client side, it gets converted to your local system time.
‘Z’ denotes that the date time value is UTC timezone. So when you use Wappler’s date formatter, it automatically tries to convert it to your local OS’s timezone.
Add a replace formatter to remove Z, and then apply date formatter. data.expiration.replace('Z','').formatDate('dd-MM-yyyy HH:mm')
I’m encountering a similar issue related to time zones in my application, and I’m wondering if anyone else has faced a similar problem or could offer some insights into what might be going wrong.
The Issue:
I have a datetime value stored in my MySQL database, which is 2023-08-22 00:00:00 . However, when I use the formatDate('yyyy-MM-dd HH:mm:ss') function on the server-side to transform this value, it gets converted to 2023-08-21 21:00:00.
I’ve read the Date and Time Settings for NodeJS post and configured my non-Docker app to the OS Default and the Database to Local (because my date data should be shown regardless of the users’ time zone.
Database Value Screenshot :
Server-Side Value from Query Screenshot :
Server-Side Transformation Screenshot :
Time Zone Settings:
MySQL Database time zone: -03
Node.js Server time zone (OS Default): America/Buenos_Aires
System time zone: America/Buenos_Aires
Despite these settings, it seems like the formatDate function is modifying the time zone or offsetting the time by 3 hours (the same difference between my Local Timezone and the UTC time).
Questions:
Could there be any internal settings or configurations that might be affecting this?
Are there any workarounds or fixes for this issue? I need the formatDate function to return the same value that is displayed when querying the database.
Thank you for your time, and I’m looking forward to any advice or insights you may have.
But if my Database and App are configured for Local Timezone, why is Wappler substracting my -3 timezone? I mean, I need to use values as the are being showed in my database, without changing values.