Hi All,
I use this script to populate a text field with the day, month and year.
For example 16-4-1985 returns 16 april 1985
New_datum is the date field and new_datumtekst is the tekst field
The problem:
Sometimes I get a wrong date in the text field.
For Example
1-4-1947 returns 31 maart 1947 instead of 1 april 1947
To fix this I probably need to add the user's UTC timezone. How can I do that?
function datumtekst(ExecutionContext){
if (ExecutionContext.getFormContext().getAttribute("new_datum").getValue() != null)
{
var Year = ExecutionContext.getFormContext().getAttribute("new_datum").getValue().getFullYear();
var Month = ExecutionContext.getFormContext().getAttribute("new_datum").getValue().getMonth();
var Day = ExecutionContext.getFormContext().getAttribute("new_datum").getValue().getDate();
var arr = new Array( "januari", "februari","maart","april","mei","juni","juli","augustus","september","oktober","november","december");
ExecutionContext.getFormContext().getAttribute("new_datumtekst").setValue(Day.toString()+" "+arr[Month] +" "+Year.toString());
ExecutionContext.getFormContext().getAttribute("new_datumtekst").setSubmitMode("always");
}
}
Thank you in advance.
Jan