Skip to content

Feature request to have mtx-datetimepicker use midnight instead of current time when the type of picker does not include time #418

Description

@Will-at-FreedomDev

We switched over from mat-datepicker components which use midnight as the time component for the Date object, however this picker (in type="date" use cases) uses the users current time as the time component. I'd like to see all non-time related pickers to use midnight if possible (date, month, year).

I understand not changing the behavior to use midnight as that might be a breaking change people may not want to swallow, but can there be an option to override that default behavior? It would be great if we could do something like this: useMidnight="true".

Ideally, I'd rather see an option that defaults to using midnight and gives you a way to opt-in to using the current time useCurrentTime="true". I think most people would find it to be more intuitive for the time component of the Date object to be midnight, but maybe I'm wrong.

<mat-form-field>
  <mat-label>Choose a date</mat-label>
  <input [mtxDatetimepicker]="picker" matInput  />
  <mtx-datetimepicker #picker type="date" useMidnight="true" /> <!-- ideally, useMidnight="true" was the default behavior -->
  <mtx-datetimepicker-toggle [for]="picker" matSuffix />
</mat-form-field>

Thank you for your time and work on these libraries.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions