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.
Hi Evelyn Igerz,
since the getFullYear Method returns a number it is treated as such.
You can simply add the js function .toString() to it to get it as a string.
Kind regards
Matthias