adopted-ember-addons / ember-pikaday

A datepicker component for Ember CLI projects.
MIT License
158 stars 169 forks source link

Date Set To Previous Day with YYYY-MM-DD Format #446

Open lynnfaraday opened 3 years ago

lynnfaraday commented 3 years ago

When I use the format "YYYY-MM-DD", the calendar picker will actually set the calendar to the previous day. This doesn't seem to happen with other formats. For example:

         <b>YYYY-MM-DD</b> <PikadayInput @value="2021-01-13"  @format="YYYY-MM-DD" />          

         <br/>

         <b>YYYY/MM/DD</b> <PikadayInput @value="2021/01/13"  @format="YYYY/MM/DD" />          

         <br/>

         <b>MM-DD-YYYY</b> <PikadayInput @value="01-13-2021"  @format="MM-DD-YYYY" />    

Gives me this:

image

The first picker is showing 1/12 instead of the specified date of 1/13.

I'm using version 3.0.0

lynnfaraday commented 3 years ago

Follow up: My friend in the UK tested this same code and saw the correct date, even for the YYYY-MM-DD format. So maybe it's somehow related to the user's timezone or something?

bekah-cheek-ao commented 3 years ago

Thank you for reporting this! I thought I was totally losing it when I found this behavior in my app.

Here's a +1 on seeing this behavior. I'm in Mountain Daylight Time (GMT-6). For the time being, I'm working around this by formatting my dates using YYYY/MM/DD instead of YYYY-MM-DD.

BonBonSlick commented 3 years ago

It also has odd behaviour when formatting, some feature stop working https://github.com/adopted-ember-addons/ember-pikaday/issues/156#issuecomment-870906128