Megabit / Blazorise

Blazorise is a component library built on top of Blazor with support for CSS frameworks like Bootstrap, Tailwind, Bulma, AntDesign, and Material.
https://blazorise.com/
Other
3.29k stars 532 forks source link

DateEdit component ignores seconds #4016

Closed andythomasdev closed 2 years ago

andythomasdev commented 2 years ago

Description When programmatically setting the Date attribute of the DateEdit component to a specific value such as DateTime.Now, the component ignores seconds, and only sets the date, hour, and minute.

To Reproduce

  1. Add a DateEdit component to a page.
  2. Set TValue="DateTime?"
  3. Set InputMode="DateInputMode.DateTime"
  4. Set Date="@DateTime.Now"
  5. Load and view the page. The field will show the current date, hour, and minute, but seconds will be 0.

Expected behavior The field should be set with the exact value of DateTime.Now when the page is rendered, including seconds.

Code image

Screenshots image

andythomasdev commented 2 years ago

@stsrki Has this been looked into?

stsrki commented 2 years ago

Not jet. Sorry, somehow it went under the radar. Adding on the backlog.

stsrki commented 2 years ago

After a little investigation, it seems that seconds are not supported with input type="datetime-local" https://stackoverflow.com/questions/58023438/cant-set-seconds-value-of-input-type-datetime-local-to-be-0

andythomasdev commented 2 years ago

Why have your DateEdit component include a selection for seconds then? Is there no way to get this to work?

andythomasdev commented 2 years ago

In an attempted workaround, I'm trying to use your InputMask component. It seems to have a bug where it is unable to distinguish between MM for month and mm for minute. When using this input, the minute section is treated as month, and I am unable to type in a value greater than 12.

image

stsrki commented 2 years ago

Have you tried with DatePicker component?

andythomasdev commented 2 years ago

No, I need to be able to enter a specific date and time down to the second. I would be fine with using the InputMask component, but as I noted above, it appears to have a bug with the InputFormat not being able to distinguish between MM for month and mm for minutes.