Skip to content

Datepicker forces time to current time #6317

@kragoth

Description

@kragoth

Bug description:

The datepicker is forcing the time portion of values to be the current time.
I believe this behaviour was introduced by PR: #6275.
Specifically if the config has "withTimepicker: false,", then the following logic will apply when initializing the value:

bs-datepicker-inline.component.ts:99 (set bsValue function)

    if (!this._bsValue && value && !this._config.withTimepicker) {
       const now = new Date();
       copyTime(value, now);
     }

This means if I'm trying to deal with dates that do not have a time component, I no longer receve 00:00:00.000 as the time. Instead I receive the current time in the time portion of the date.

Now, I figured all I need to do was add "initCurrentTime: false" to my config but, as you can see above that logic ignores the "initCurrentTime" configuration.

I think the above logic should honour the "initCurrentTime" configuration and not override the time if that is set to false.

I can't seem to get Stackblitz to see version 7.1.2 so I can't create one.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions