Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minDate and maxDate always uses timezones. Disregards passed Moment #1294

Closed
phrfpeixoto opened this issue Aug 28, 2015 · 4 comments
Closed

Comments

@phrfpeixoto
Copy link

I've been struggling to set a min/max date using a regular unix timestamp, and i noticed that the datetimepicker always disregards the passed Moment in UTC, and subtracts my zone offset.

Fiddle: http://jsfiddle.net/ypt78kt8/

Notice that the min moment should be 2015-07-26T06:05:26+00:00, but the widget allows me to select 2015-07-26T04:05:26 (I'm currently in GTM-3).

it actually sets the minDate to 2015-07-26T03:05:26-03:00, and that's not the passed moment.

@jeremyVignelles
Copy link
Contributor

Quite the same problem here, at UTC+2 :
Local time : 11:10
UTC time : 09:10

The min date is correctly set, but, when using the "use Current" option (instead of minDate)

  • the time is set to 00:00
  • each time I open the date picker, the time goes back by 2 hours.

When using minDate combined with useCurrent, I can't select the date at 10:00 UTC

Hope this helps for debugging, it is an important feature for us...

@jeremyVignelles
Copy link
Contributor

OK, I tried some a few things after posting and I have to correct some of my assertions:

  • The time set to 0 is due to issue Time always starts at 12:00 AM #1311
  • With minDate and useCurrent, I tried minDate: new Date(), minDate: moment(), minDate: moment().tz('UTC'). Only the third option let me choose 10:00 UTC. The first two dates were displayed in the input without any time zone ('z' format) identifier

@jeremyVignelles
Copy link
Contributor

Regarding my comment about "each time I open the date picker, the time goes back by 2 hours.". This is an issue with the knockout binding. (explained in #1304)

@eonasdan-bot
Copy link
Collaborator

Hello. Thanks for using my project. We’re closing all tickets/prs for v4 as it is no longer supported. We’re making way for a new version. Please read this blog post

Repository owner locked and limited conversation to collaborators Nov 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants