wakirin / Litepicker

Date range picker - lightweight, no dependencies
MIT License
898 stars 132 forks source link

Wrong behavior in January 1970 #274

Open Pryx opened 3 years ago

Pryx commented 3 years ago

Describe the bug We are using Litepicker to select ranges of chart data. Recently we've encountered weird behavior when selecting data starting in January 1970. It's impossible to select any range starting anywhere from 1970-01-01 to 1970-01-12. The date 1970-01-01 does not work at all while the other dates just return weird values. Example output of an attempt to select range from 1970-01-02 to 1970-01-31 on the litepicker website can be seen in the screenshot below

image

When I tried to set the date programmatically using the setDateRange method everything seemed to be OK.

The predefined range plugin also doesn't work properly when there is a range starting with 1970-01-01 (not sure about other dates), maybe it's related?

To Reproduce Steps to reproduce the behavior:

  1. Go to January 1970
  2. Try to select any range starting somewhere from 1970-01-01 to 1970-01-12 ending with any date you wish
  3. See error

Expected behavior I expected to be able to select the range properly :slightly_smiling_face:

jsfiddle.net / codepen.io / etc https://jsfiddle.net/pryxcz/85mnLrcs/14/

shubham-shrivastava commented 2 years ago

I am having the exact same issue with Litepicker 2.0.12.

DMA0000 commented 1 year ago

I am having the exact same issue with Litepicker 2.0.12.

I am having the same issue how you fix it.