Skip to Content
0
Jan 05, 2023 at 04:32 PM

Analytics Designer Get current month

288 Views

Hi,

it seems like there is a problem when trying to get the current month:

var cur_date = new Date(Date.now());

console.log("Date:");
console.log(cur_date.toDateString());
console.log(cur_date.getMonth());
console.log(cur_date.getFullYear());
console.log(cur_date.getUTCMonth());

Here is the output.

Date:
sandbox.worker.main.8688e4d0a63c11814b99.js:1 Thu Jan 05 2023
sandbox.worker.main.8688e4d0a63c11814b99.js:1 0
sandbox.worker.main.8688e4d0a63c11814b99.js:1 2023
sandbox.worker.main.8688e4d0a63c11814b99.js:1 0

Seems like the getMonth() function is not working as intended. Does anybody have the same problem or knows a solution?