nainemom / idate

Iranian Date constractor for Javascript, Just like native Javascript Date.
57 stars 1 forks source link

Jalali Month Bug #8

Closed alijawadi closed 4 years ago

alijawadi commented 4 years ago

I'm trying to get the jalali month with this simple code but it gives me wrong month number, today is 8th of march / 18th of esfand but getMonth(); returns 11 which is Bahman.

const today = new IDate(new Date());
console.log(today.getMonth());  //logs 11 to the console.
nainemom commented 4 years ago

getMonth method in javascript Date constructor will always returns index of month starting from zero. So 11 is equals to Esfand and 0 is Farvardin.