Hi,
the table contains a DateTime field and in most cases it is the time of record creation. To simplify data entry for users, I want to pre-fill this field for a new record. I used the following onLoad script:
const praveTed = new Date();
doo.model.datumACas.value = praveTed;
doo.toast.info(praveTed);
The field is inserted with a time one hour higher (+1) than the current time. But the info toast with the output of the same variable prints the correct current date and time (see attached screenshot).
Where is the error? How to write the correct time into the field using a script?
The application time zone is set to Europe/Prague.
THANKS, it works…
But why? I assume that the values are stored in the db in UTC and when displayed are adjusted according to the time zone set for the application. But when writing to the field using the script doo.model.datumACas.value = praveTed; is it necessary to use hard UTC time, but without the UTC zone designation (Z at the end)?
Do I understand this correctly?
I have a script that creates a duplicate record when saving one. One field is in datetime format. I’m using doo.table.createRecord function to duplicate. Date field is mapped like this:
“data”: doo.model.data.value,
I’ve used your formula to set the default datetime for today and displaying the date on the first record works properly
BUT
on the duplicate record the time displayed is 2 hours before.
I have console.log on this field set and in the both records it shows the same value inside:
may I just ask how you create duplication? Via WF client or server? Please try both options. In the new version of the application, the bug with the date in the counted field will be fixed (also 2h less). Feel free to send me part of the code so I can simulate it as best as possible.