Closed joyenjoyer closed 7 months ago
Preview URL: https://1414--preview-instui.netlify.app
looks better now, but if there is a
defaultValue
then its value is ignored. To reproduce use this code:class Example extends React.Component { render () { return ( <div style= { {height: '10rem',width: '40em'}}> <DateTimeInput description="Pick a date and time" datePlaceholder="Choose a date" dateRenderLabel="Date" timeRenderLabel="Time" invalidDateTimeMessage="Invalid date!" prevMonthLabel='Previous month' nextMonthLabel='Next month' defaultValue="2018-01-18T13:30" layout="columns" initialTimeForNewDate="23:43" /> </div>) } } render(<Example />)
delete the date value, click outside of the component, and then enter a valid date. It will use
12:00
instead of23:43
as date value
This is what we discussed in a meeting and what you requested in the comment above the last one:
if I enter both defaultValue and initialTimeForNewDate the component crashes with
TypeError: Cannot read properties of undefined (reading 'timeSelectValue')
it should disregardinitialTimeForNewDate
and output a warning that it does nothing
If both props are present now, initialTimeForNewDate
is ignored. A warning message is thrown too:
Warning: [DateTimeInput] if defaultValue is set, initialTimeForNewDate will be ignored. logMessage @ console.js:53
Let me know if there is a misunderstanding!
…nput
Closes: INSTUI-3966
Test:
initialTimeForNewDate
on DateTimeInputdefaultValue
prop is not setinitialTimeForNewDate
value appears in the TimeSelect input field