Code: Select all
if (nuIsNewRecord()) {
nuSetDateValue(this.id);
}
For a Datetime-local, having change the date format as datetime in the sql db, doing the same approach doesn't work. How can you do that in Datetime-local object ?
Many thanks,
Code: Select all
if (nuIsNewRecord()) {
nuSetDateValue(this.id);
}
Code: Select all
nuSetValue(this.id, new Date().toJSON().slice(0,19));
Code: Select all
if (nuIsNewRecord()) {
var ld = new Date(new Date().getTime() - new Date().getTimezoneOffset() * 60000) // you keep the timezone difference with UTC and you add this to
//the date.--- ld stands for local date ---
nuSetValue(this.id, ld.toJSON().slice(0, 16));
}
Code: Select all
new Date(new Date().getTime() - new Date().getTimezoneOffset() * 60000)
But the current UTC time is 11:45 and my local time is 13:45.Fri Apr 22 2022 15:46:02 GMT+0200 (Central European Summer Time)