[SOLVED] Can anyone help me have the game detect the month and day the player is playing my game on?

I started to work on Arescape again, and the first thing that I was going to do is make it so that ballons (maybe streamers too if I get that far) appear on May 15 (my birthday), but I cannot find the reference in the developer or developer pages, and nothing I found in the discussion pages helped ether, can anyone tell me how to detect the month and day based on the device’s internal calender?

what I got so far in the script: PlayCanvas | HTML5 Game Engine

Hi @Linkplayer,

Check out this documentation on how to work with dates in Javascript:

I hope this is helpful.

I tried this, but it wants me to set a date directly, I don’t see anything that works with the detectDate script which is what I believe is what I need, but thanks.

You would want to make a new Date object and then extract the information from it like this:

const now = Date.now();
const date = new Date(now);

console.log(date.getMonth()); // prints current month (i.e 0 for January)

it works until I put the vanish script on, where then it says as an error “this is not a date object”, do you know what I am doing wrong?

 var month = date.getMonth
 var day = date.getDate

Keep in mind that on lines 7 and 8 of your code that getMonth and getDate are functions, not properties, so you will have to execute those functions:

 var month = date.getMonth()
 var day = date.getDate()

thanks, the next problem the error said was, “Month is not a function”, I accidentally put month in the if statement as month(), which I fixed. now it is working