Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.

timepicker variable date, hard to compare. #5722

Closed
lmcmgig opened this issue Mar 31, 2016 · 7 comments
Closed

timepicker variable date, hard to compare. #5722

lmcmgig opened this issue Mar 31, 2016 · 7 comments

Comments

@lmcmgig
Copy link

lmcmgig commented Mar 31, 2016

Bug description:

timepicker create a new Date with the current time. Result if you try to compare the output without processing the date itself, the same time (i.e. 16h00) can be different. Using always the same time reference ease the comparaison.

Proposed code modification:
.controller('UibTimepickerController', ...
var selected = new Date(0), //or 86400000 if you don't like negative number when offsetting for the timezone and using getTime().

Version of Angular, UIBS, and Bootstrap

Angular 1.5.0
UIBS 1.2.4
Boostrap 3.3.6

@icfantv
Copy link
Contributor

icfantv commented Mar 31, 2016

@lmcmgig, please be respectful of our time by creating a minimally working plunker with the issue and proposed fix. You can use the plunker link in our demo page to get you 19% of the way there.

@lmcmgig
Copy link
Author

lmcmgig commented Mar 31, 2016

Hi,

 I wish, but the result will be the same visually speaking.  The 

back-end code using it will be simplier. Plunker doesn't help in that case.

@icfantv
Copy link
Contributor

icfantv commented Mar 31, 2016

This is a breaking change because instead of defaulting to now(), it's now defaulting to 01JAN1970 GMT...

Can you please elaborate further in order to provide some justification....?

@icfantv
Copy link
Contributor

icfantv commented Mar 31, 2016

Ok, maybe I'm just not following...

@lmcmgig
Copy link
Author

lmcmgig commented Mar 31, 2016

For example, I'm using the date in a JSON. In the application I need to
identify changes to allow some behaviour. But 16h00 of any day is 16h00
in a timepicker. So if you use the timepicker on 2 different day the
date in the back will not be the same even if the time (16h00) is the same.

We can process at an higher layer, but everybody using the library will
need to code the same thing (more or less).

@icfantv
Copy link
Contributor

icfantv commented Mar 31, 2016

Ahhhh. I got it. Thanks. @wesleycho, @Foxandxss thoughts?

@wesleycho
Copy link
Contributor

Closing as won't support, or extremely vague/poorly worded - parsing the sentences hurts my head.

We have decided that due to the special issue in #5485, we are recommending that the date object used in the timepicker is separate from any other date usage, and we will be requiring that users process the two models appropriately.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants