Datepicker time range defaultValue

Hi everyone.

I am trying to set the defaultValue of the Datepicker and am having trouble getting the format correct?
Can I send in an array, start and end, can these be number or string?
There are no examples of this particular requirement that I can find.


Hello Jason :wave:

As we discussed in the other thread, this is a bug and when it’s fixed, I’ll let you know.

Until then, an alternative solution would be to define the default value like this :point_down:

const [value, setValue] = React.useState(["09:30", "18:15"]); 
const myChange = (ev) => { setValue(ev.value); } 

<Datepicker value={value} onChange={myChange} select="range" controls={['timegrid']} stepMinute={15} theme="material" returnFormat="iso8601" />

Hi @Jason :wave:

Good news: we have shipped Mobiscroll 5.27.2, where we fixed an issue where the value parsing resulted in error if defaultValue was set for the range picker in React.

Here you can find a guide of how you can update the Mobiscroll version to the latest: Update guide on the latest version of Mobiscroll for plain JS, jQuery, Angular, Ionic and React.