Open dudedev opened 9 years ago
This is because angular-ui timePicker uses a date and it was overwriting the one selected, which isnt a problem when using both date and time pickers. I have now changed the code so when the time is changed, it will not overwrite any part of the date. Uploading this version now, which is 1.2.2
Issue still remains. If you clear out the time , it clears out the date as well.
This is correct. If you press Clear, it will clear the model
On Mon, Sep 14, 2015 at 3:11 PM, dudedev notifications@github.com wrote:
Issue still remains. If you clear out the time , it clears out the date as well.
— Reply to this email directly or view it on GitHub https://github.com/Gillardo/bootstrap-ui-datetime-picker/issues/47#issuecomment-140088465 .
But If someone wants to clear out the time, it should not change the date.. Isn't it...? Consider someone has two different fields for date and time on screen which uses the same model, chaning one changes the other...it will annoy the user.
But clear should clear, the change your proposing is actually to set the hours, minutes and seconds to zero, as you cannot have a a blank time in a date object.
Your best bet would be to just create a watch on your model, and if is is null, restore just the date part of it with the original value. Something like
$scope.$watch(function() {
return ctrl.yourModel;
}, function(oldValue, newValue) {
if (newValue == null) {
var date = oldValue;
date.setHours(0);
date.setMinutes(0);
date.setSeconds(0);
ctrl.yourModel = date;
}
}
Even with this in place though, your time will still not be blank, but just set to midnight.
On Mon, Sep 14, 2015 at 3:27 PM, dudedev notifications@github.com wrote:
But If someone wants to clear out the time, it should not change the date.. Isn't it...? Consider someone has two different fields for date and time on screen which uses the same model, chaning one changes the other...it will annoy the user.
— Reply to this email directly or view it on GitHub https://github.com/Gillardo/bootstrap-ui-datetime-picker/issues/47#issuecomment-140098415 .
Yes, Exactly, This is what I expect.
So your saying. if clear it pressed on the datepicker, it should clear it. But if clear is pressed on the timePicker is should reset the time to 00:00:00?
On Mon, Sep 14, 2015 at 3:45 PM, dudedev notifications@github.com wrote:
Yes, Exactly, This is what I expect.
— Reply to this email directly or view it on GitHub https://github.com/Gillardo/bootstrap-ui-datetime-picker/issues/47#issuecomment-140104020 .
Yes, I think if someone wants to use datepicker and timepicker separately using your library, he should be able to do so. If you use timepicker of bootstrap you use the same date model, but with bootstrap timepicker, it changes only the time, not the date part. Isn't it.?
There's alot of datepickers and timepickers out there why would someone who wants to use only one or the other use a datetimepicker?
Because on the system i used this for fields can be configured as date, time snd datetime On 17 May 2016 15:26, "Kiruwagaka" notifications@github.com wrote:
There's alot of datepickers and timepickers out there why would someone who wants to use only one or the other use a datetimepicker?
— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/Gillardo/bootstrap-ui-datetime-picker/issues/47#issuecomment-219734571
Plus this directive uses controls already in the angular-ui suite so no need for a whole new package to be included
For anyone that stumbles onto this, newValue
and oldValue
arguments are switched, at least in angular 1.5. The code snippet worked for me. Thanks @Gillardo !
Issue still remains if you specify timezone in your date format. You can see it in this Plunker if you click down through the hours selector enough times you'll see the date randomly change. http://plnkr.co/edit/Zh1J8gSQjA9s1R3K9utE?p=preview
I am having a problem where changing the time changes the date.
Right now I can't make a gif of it to clarify what I mean, but whenever I can I'll do.
Using a $watcher is not a feasible thing for me to do because I use the this datetime in loads of forms, and creating a $watcher for every datetime picker is boring :)
Can u make a plunkr to replicate?
No need for a plunkr. You can replicate the bug in your demo page: https://rawgit.com/Gillardo/bootstrap-ui-datetime-picker/master/example/index.html using the date and time picker example.
So, the datetime-picker starts like this:
After picking a date (in this case picked October 1st, which is not today)
Then you get to pick the time
And if for any reason you need to delete part of time
You lost the previously inserted date
It would also be nice if the date part was kept on the text box, to assure the user that the previously selected date wasn't lost.
Thank you for reviewing this.
N0NamedGuy: I have the exact problem that you reported :(
Hi, If there is change in time, it changes the date part also, even if the enable-date="false".