Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

toLocaleDateString is not working in server side script

aikotoba
Tera Guru

Hi
We need to convert a date to Japanese calendar.
On the client side, dt.toLocaleDateString('ja-JP-u-ca-japanese',{era: 'long'}) works and converts the date to the Japanese calendar without any problem, but
However, the business rule does not work well.
Doesn't it work on the server side?
Please help.

function onChange(control, oldValue, newValue, isLoading) {
	if (isLoading)
        return;

    if (newValue == "") {
        g_form.clearValue("end_date_japanese");
        return;
    }
	;
	var dt = new Date(newValue);
	var japaneseDate = dt.toLocaleDateString('ja-JP-u-ca-japanese',{era: 'long'})
	g_form.setValue("end_date_japanese",japaneseDate);
}

 

 

1 ACCEPTED SOLUTION

aikotoba
Tera Guru

toLocaleDateString does not seem to be supported
Created a custom Japanese calendar conversion script

View solution in original post

6 REPLIES 6

aikotoba
Tera Guru

toLocaleDateString does not seem to be supported
Created a custom Japanese calendar conversion script

Not applicable

Hi @aikotoba ,

I think you have wrongly marked your own answer as correct!!

Because i said the same thing on my answer too, since "toLocaleDateString" is not supported gave another approach to achieve your requirement.

Kindly mark the applicable answer as Correct & Helpful both such that others can get help.

Thanks,
Sandeep