SAP / ui5-webcomponents

UI5 Web Components - the enterprise-flavored sugar on top of native APIs! Build SAP Fiori user interfaces with the technology of your choice.
https://sap.github.io/ui5-webcomponents/
Apache License 2.0
1.5k stars 258 forks source link

DateTimePicker minDate should consider also the time #3279

Open dioogo opened 3 years ago

dioogo commented 3 years ago

Is your feature request related to a problem? Please describe. The minDate property in the DateTimePicker component refers only to the date, not considering the time.

Describe the solution you'd like I would like minDate to consider not only the date but, also, the timestamp.

Describe alternatives you've considered Another alternative would be to create a new property (like minTime) in addition to the minDate

Lukas742 commented 3 years ago

Hi @dioogo

as the DateTimePicker component is developed by the UI5 Web Components colleagues, I'll forward this issue to their repo.

TeodorTaushanov commented 3 years ago

Hello @SAP/ui5-webcomponents-topic-b, can you check this feature request?

henriquemattos commented 1 year ago

Hi, what's the status of this request?

Currently if my minDate include Hours/Minutes, the validation fails when I manually input a value lower than the minDate. The Hour- and Minute-step feature also allows the user to select previous hours than the defined in minDate

A very simple example:

<ui5-datetime-picker name="coption" id="reservation-date" hide-week-numbers="true" format-pattern="dd/MM/yyyy, HH:mm" value="26/10/2022, 10:59" min-date="26/10/2022, 12:30" max-date="01/12/2022, 23:59" ui5-datetime-picker="" value-state="None">
    <div slot="valueStateMessage"></div>
</ui5-datetime-picker>

This value with a JS listening to change gives the following:

const value = event.detail.value;
console.log(value, event.detail.valid, component.isValid(value), component.isInValidRange(value));
26/10/2022, 10:59 true true true

Update 1: added const value... to JS snippet. Update 2: Referencing my previous comment https://github.com/SAP/ui5-webcomponents/issues/5157#issuecomment-1140454791 . 😢

petyabegovska commented 1 year ago

Hi,

Providing min/max values to Time Picker and DateTimePicker components is pending UX/VD design. After that we can plan the development options, but I don't see it feasible in the next 3 months. Also the Time picker component should be redesigned first to the new UI5 design: https://openui5nightly.hana.ondemand.com/entity/sap.m.TimePicker/sample/sap.m.sample.TimePicker

Best regards, Petya

henriquemattos commented 1 year ago

That's not a good answer. There's a bug in the current validation of DateTimePicker and you tell us that the next iteration is depending on the new UX/UI specification.

petyabegovska commented 1 year ago

Hi @henriquemattos,

Can you provide an isolated example in CodeSandbox, where the bug can be reproduced?

Thanks and best regards, Petya

henriquemattos commented 1 year ago

Hi, @petyabegovska, providing a CodeSandbox required me time, despite having provided the code snippet already.

Here's a CodeSandbox: https://codesandbox.io/s/mystifying-stonebraker-icssb7?file=/index.html

If you inspect the console result on change, you can select the time 06:30 and still have the validation of isValid and isInValidRange, despite the min-date being 13:00 and the max-date being 23:59. Could be that who implemented isInValidRange wanted to mean isInvalidRange? 🤪

Kind regards, Henrique