Since the release of v4.17.37 the time isn't set correctly when clicking on the date-picker the first time; even with the useCurrent option enabled. It does always display 12:00 AM now.
See the fiddles below to see exactly what I mean:
v4.15.35: https://jsfiddle.net/xjeyxaf3/
v4.17.37: https://jsfiddle.net/86mkLccu/
As far as I can see, the failure is cause by the newly introduced getMoment() function which strips down the date to a hole day (which moment.js defines at 12:00 AM) by default.
both of those fiddles point to the same source btw ;)
I have updated the post some time ago with the correct links ;)
What is the reason for stripping down the dates to a hole day? Can it just be removed?
the new getmoment function was brought in by a PR. I didn't noticed the start of day issue.
Maybe I have time tomorrow to look into the issue :)
I was the creator of the getMoment function, I can certainly look into this and see what the issue is.
So I have an open pull request that has a bunch of changes but one of the updates fixes this particular issue. Hopefully you can cherry pick the fix,
Is this issue still active? What still needs to be done to fold the fix into the master branch?
It seems to still appear on the latest version,
time is always set to 10:00 AM. Did anyone fined a fix?
Many thx
@code-making-machine seems that it's fixed only in development branch, not in master
https://github.com/Eonasdan/bootstrap-datetimepicker/tree/development
Many thx,
using the development tree did the trick indeed.
When it is planned to merge the change in terms of getMoment() into master?
If you want to stick to the releases, you can fix this problem with a little bit of code:
$('#datetimepicker').datetimepicker({
format: 'YYYY-MM-DD HH:mm:ss',
useCurrent: false
}).on('dp.show', function() {
// https://github.com/Eonasdan/bootstrap-datetimepicker/issues/1311 (Time always starts at 12:00 AM)
if($(this).data("DateTimePicker").date() === null)
$(this).data("DateTimePicker").date(moment());
});
Most helpful comment
If you want to stick to the releases, you can fix this problem with a little bit of code: