Format Date-Property several times

Hello Radzen-Team,

I want to do the following:

  1. Create a property "datetemp" with value "new Date().toLocaleString("de-DE", {timeZone: "Europe/Berlin"})"
  2. Create a property "date" with value "${datetemp.toISOString();" to get my property date well formatted to be written into database.

But this leads to an cosole-error: "this.date.toISOString is not a function".

Is there a way to to this in Radzen?

Thanks in advance,

Martin

It is expected to get this error since datetemp is a string and not a Date. You need to introduce another property which stores the date value (e.g. new Date()) as a Date instance and later use it wherever needed.

@korchev

Thank you for your help, I solved it with

Set date to new Date();

and then

Set utcdate to new Date(
Date.UTC(
this.date.getFullYear(),
this.date.getMonth(),
this.date.getDate(),
this.date.getHours(),
this.date.getMinutes(),
this.date.getSeconds(),
this.date.getMilliseconds()
)
)

Works!