Tempus-dominus: Issue with selectDay, when Time is set on DOM load

Created on 29 Aug 2016  路  3Comments  路  Source: Eonasdan/tempus-dominus

So there is a problem with the selectDay function on line 1027 which is not taking into account the time, that has been set on the date object.

Im not sure how to fix this, since selectDay is a private function and i dont want to modify the Source Code. I have seen, that another Person (Issue #1741) has the same problem, when setting the Time to 00:00.

This is what i added on line 1036

if(date._d != undefined){
    day._d.setHours(date._d.getHours());
    day._d.setMinutes(date._d.getMinutes());
    day._d.setSeconds(date._d.getSeconds());
}

Could somebody verify if this is not breaking anything.

v4

Most helpful comment

+1 here. Noticing that 4.17.42 ignores the time parsed from the input element's value and instead uses the current time when a day is selected. Subsequent day selections do no affect the time component.

All 3 comments

+1 here. Noticing that 4.17.42 ignores the time parsed from the input element's value and instead uses the current time when a day is selected. Subsequent day selections do no affect the time component.

The variable day is filled with the viewDate and doesn't take into account what time is already set

 selectDay: function (e) {
                    var day = viewDate.clone(); // takes the current view date to set the date
                    if ($(e.target).is('.old')) {
                        day.subtract(1, 'M');
                    }
                    if ($(e.target).is('.new')) {
                        day.add(1, 'M');
                    }
                    setValue(day.date(parseInt($(e.target).text(), 10)));
                    if (!hasTime() && !options.keepOpen && !options.inline) {
                        hide();
                    }
                },

Hello. Thanks for using my project. We鈥檙e closing all tickets/prs for v4 as it is no longer supported. We鈥檙e making way for a new version. Please read this blog post

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dungphanxuan picture dungphanxuan  路  3Comments

dleffler picture dleffler  路  4Comments

malhayek2014 picture malhayek2014  路  4Comments

thw0rted picture thw0rted  路  5Comments

lllopo picture lllopo  路  7Comments