Issue storing a date calculated using Javascipt to BDM Date-Time (no time zone)

1
0
-1

Hi Community,

We are using JavaScript on the form to calculate the next date and time based on a day of the week, hour and minute.

We are using the following function to calculate the next date.

function getNextDate(startdate, nextDay, nextHour, nextMinute) {

var resultDate = new Date(startdate.getTime());

resultDate.setDate(startdate.getDate() + (7 + nextDay- startdate.getDay()) % 7);
resultDate.setHours(nextHour);
resultDate.setMinutes(nextMinute);
resultDate.setSeconds(0);
resultDate.setMilliseconds(0);

return resultDate;
}

The returned date is ok in GMT-4. How can we get the date calculated in GMT so that when it is saved in the BDM Date-Time (no time zone) it is impacted by the timezone.

1 answer

1
0
-1

Hi,

Did you have a look to this thread ?

I recommend using a DATE-TIME (No Timezone) type in your BDM to avoid dealing with this kind of timezone offsets issues (if it fits your use case ofc).

Using this type, you can post a ISO-8601 format string date like 2021-08-03T09:05:00 and ignore the timezone.

HTH
Romain

Comments

Submitted by dmartineau on Mon, 08/09/2021 - 15:25

Hi Romain,

We are using the Date-Time (No Timezone). (question updated)

It looks like the timestamp is calculated properly but when the date is set using javascript in the UI designer, the widget does not trim the timezone.

What is the best way to get around this?

Notifications