jackducasse / caleandar

A lightweight, library independent JavaScript calendar
MIT License
80 stars 41 forks source link

Month starts counting at zero #1

Open scubamiller opened 7 years ago

scubamiller commented 7 years ago

When I enter an event date of 6 it displays in July. Logically 6 should be June. Looks like it is counting starting at 0 as a entry of 0 displays as January.

The day and year number display correctly.

Love it other than that.

Thanks Tim

var events = [ {'Date': new Date(2016, 6, 1), 'Title': 'Doctor appointment at 3:25pm.'}, {'Date': new Date(2016, 6, 7), 'Title': 'New Garfield movie comes out!', 'Link': 'https://garfield.com'}, {'Date': new Date(2016, 6, 11), 'Title': '25 year anniversary', 'Link': 'https://www.google.com.au/#q=anniversary+gifts'}, ];

icaroscherma commented 7 years ago

@scubamiller this is because of the JavaScript's Date's API description says that it starts with 0, and since Caleandar is using the default JS api for this, isn't actually an issue.

For instance open your console and type new Date(2016, 6, 1), the output should be something similar to Fri Jul 01 2016 00:00:00 GMT-0300 (E. South America Standard Time), as you can see it says Jul (July).