igerz01

Change year value into string

Discussion created by igerz01 on Feb 4, 2019
Latest reply on Feb 6, 2019 by igerz01

I have a simple list with a date field, named "Deadline", and a single line of text field named "Year".

Whenever the value of the "Deadline" field changes, I want to have the year of it in the separate field "Year".

For this, I'm using Rich Forms (version 3.1.27.17).

Within the NewForm.aspx I marked the "Year" field, and inserted the following code to calculate the field value:

 

var date = new Date([[Deadline]]);

return date.getFullYear();

 

While testing the code, I get the following result:

 

 

The year is returned as figure/number and not as a string (instead of "2019" the value "2 019,00" is appearing).

Can somebody tell me what I'm missing in my code?

 

Thanks for your help.

Outcomes