help with date function of javascript

const date = new Date(2024,2,0)
date.setDate(date.getDate()+4)
console.log(date)
const date = new Date(2024,2,0)
date.setDate(date.getDate()+4)
console.log(date)
if the result of (date.getDate()+4) is 33 then the second line of code should set the date value of the date const to 33, which means the result should be april 02 2024 right? why is march 04 2024 the result then
1 Reply
Want results from more Discord servers?
Add your server