angular-datepicker icon indicating copy to clipboard operation
angular-datepicker copied to clipboard

Hours view is not properly showing 0-24 hour items (adding hours from previous day).

Open Frondor opened this issue 10 years ago • 7 comments

Maybe this has something to do with my time zone offset?.. I don't know, please check yourself, I'm null at date/times: http://www.timeanddate.com/time/zone/uruguay/montevideo

I can't select hours past 20:00 of the selected day, but I can select 21, 22, 23hs of previous day, which I believe it's not intended to be like that...

Any guess on this? I tried adding these files <script src="//momentjs.com/downloads/moment-timezone.min.js"></script> <script src="//rawgit.com/qw4n7y/7282780/raw/6ae3b334b295f93047e8f3ad300db6bc4387e235/moment-timezone-data.js"></script>

and creating a constant:

angular.module('myAngularApp') .constant('angularMomentConfig', { timezone: 'America/Argentina/Buenos_Aires' });

(using America/Argentina/Buenos_Aires because it's the closer one)

"angular-datepicker": "~1.0.16"

EDIT: This is also happening with Months in month view:

Result: Sun Sep 20 2015 22:05:00 GMT-0300 (Hora estándar de Montevideo)

Frondor avatar Sep 18 '15 21:09 Frondor

In the code there is this function

var createNewDate = function(year, month, day, hour, minute) {
    // without any arguments, the default date will be 1899-12-31T00:00:00.000Z
    return new Date(Date.UTC(year | 0, month | 0, day | 0, hour | 0, minute | 0));
};

It uses UTC. I'm pretty sure that it has to do with your timezone, and this function. I'm trying to find a way to make it work right now.

carterw485 avatar Oct 14 '15 22:10 carterw485

If it becomes a pull request, let me know and I'll test it

Frondor avatar Oct 16 '15 15:10 Frondor

I have the same problem. Here timezone is UTC+3.

Also, another important problem is that if you choose 00:00, 01:00 or 02:00 in the picture below, it will change day to next day. Ex: Choose October 20, than choose 01:00. Now the date is October 21, 01:00. So, if the user wants to select October 20 01:00, he should first select October 19 and than 01:00. This is a very strange thing to do.

It would be great to fix that issue.

date-picker

erkanarslan avatar Oct 17 '15 11:10 erkanarslan

Check your lib version, this seems to have been fixed in release 1.0.18.

markahon avatar Oct 21 '15 20:10 markahon

Yes, version 1.0.18 fixes the problem

erkanarslan avatar Oct 22 '15 07:10 erkanarslan

This appears not to be fixed for half hour scenarios in timezone offsets. screenshot from 2016-04-08 17 12 35

My local time is that of India (+5:30). This results in missing range of 1 hour from 23:30 to 00:30. You can try reproducing the same in your demo itself by setting your local timezone to India.

grvdahiya avatar Apr 08 '16 11:04 grvdahiya

FYI my version is - "~2.0.3"

grvdahiya avatar Apr 08 '16 11:04 grvdahiya