Search code examples
javascriptangularjstimepickerangular-strap

Angularstrap Timepicker's millisecond timeFormat is one hour off


I am using the timepicker directive of Angularstrap (mgcrea.github.io/angular-strap/#timepickers) with the number timeformat (milliseconds). When passing an initial ng-model-value in, the representation of this value is one hour off in my opinion. If I pass in 0, the time will be 01:00. In my opinion it should be of course 00:00.

This is my config:

angular.extend($timepickerProvider.defaults, {
  timeFormat: "HH:mm",
  timeType: "number",
  minuteStep: 10,
  container: "body"
});

See this plunker: plnkr.co/edit/B0lWqbhL7AeynyeRE8EG

Am I missing something? Is this indeed the correct behaviour?


Solution

  • Turns out this is indeed the correct behaviour. I was forgetting that the numeric value passed in is a COMPLETE date. So the value 0 will be 1970-01-01 00:00:00 in UTC and of course something different in my timezone.