Search code examples
reactjsreact-day-picker

why I get display next month instead of current month


Why I see this page is in wrong month, it should init to show August instead of September , I am from cambodia

enter image description here http://react-day-picker.js.org/examples/months-initial


Solution

  • From MDN docs: The argument month is 0-based. This means that January = 0 and December = 11.

    var startOfYear =  new Date(2017,0)
    console.log(startOfYear.toLocaleString())

    Reference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date