How do I initialize the date so that it works correctly in any browser?

I have this code in StoryInit:

<<set $curDate = new Date('June 14 2025')>>
<<set $month = $curDate.toLocaleString('default', { month: 'long' })>>
<<set $day = $curDate.getDate()>>

/* day segments */
<<set setup.dayPart = ["Morning", "Day", "Evening", "Night"]>>
<<set $gameTime = 2>> /* start in the first day segment, evening */
/* day segments. END */

/* week segments */
<<set setup.dayName = ["Sun", "Mon", "Tue", "Wen", "Thu", "Fri", "Sat"]>>
<<set setup.dayName.toString('active')>>
<<set $gameDay = 5>> /* start in the first day Friday */
/* week segments. END */

When i run the game in Google chrome,everything works well, and when in Firefox, this error crashes all:
“A fatal error has occurred. Aborting.
Error: invalid date.”

Question: "How do I initialize the date so that it works correctly in any browser?’

hiya!

That;s because Date() is already a defined object in JavaScript, and if you use Date(something) it will only accept a number, not a string).

If you are looking to create a date/time system, I would recommend this custom macro.

Why it correctly works in chrome?
I take this info from:

Sample Code

but in Firifox is error. How i need write to work?

That code also includes the hours, minute, and seconds, which your code is missing.

<<set $CurDate = new Date('June 14, 2018 15:30')>>

nope, i write all you say, with hours and minuts and Firefox error still show on start html file and when click “Ok” load base page or default page without any style or my code - blank page.

I found work solution by myself. This code work in all browsers:

<<set $curDate = new Date("2013-03-08")>>
<<set $month = $curDate.toLocaleString('default', { month: 'long' })>>
<<set $day = $curDate.getDate()>>