I’m trying to test out rc1 of Ionic React 6, and I’m having some trouble with my <IonDateTime>
component.
According to the docs (ion-datetime | Ionic Documentation (ionicframework.com)), I should be able to set the time like this:
13:47
However, these simple values don’t work.
For example, I tried
<IonDatetime
presentation="time-date"
value="13:47"
/>
And the year:
<IonDatetime
presentation="time-date"
value="1994"
/>
Both of these give an error:
index.js:1
RangeError: Invalid time value at generateDayAriaLabel (ion-datetime.js:664) at getCalendarDayState (ion-datetime.js:855) at ion-datetime.js:1625 at Array.map (<anonymous>) at HTMLElement.renderMonth (ion-datetime.js:1622) at ion-datetime.js:1646 at Array.map (<anonymous>) at HTMLElement.renderCalendarBody (ion-datetime.js:1645) at HTMLElement.renderCalendar (ion-datetime.js:1650) at HTMLElement.renderDatetime (ion-datetime.js:1754) at HTMLElement.render (ion-datetime.js:1788) at callRender (index.js:1434) at updateComponent (index.js:1372) at index.js:1353 at then (index.js:1583) at dispatchHooks (index.js:1353) at Array.dispatch (index.js:1321) at consume (index.js:2937) at flush (index.js:2992)
The UTC string does work:
`value="1994-12-15T13:47:20.789Z"`
However, I want to have an input that only shows the hours and minutes, so I don’t actually need to store the date, just the time. And I’m connecting to a Drupal site that returns the date as HH:mm, so if possible, I don’t want to have to process date information, since I’ll just be throwing it away.
How can I set the value using just the time?