When a Datepicker is used with a timezone, the initial date is reset. Using Mobiscroll v5.18.13.
In the example below, the initial date is set:
import { Datepicker, luxonTimezone } from '@mobiscroll/react';
import * as luxon from 'luxon';
luxonTimezone.luxon = luxon;
export const MobiscrollDemo = () => {
const [date, setDate] = React.useState([
'2022-09-28T05:00:00.000Z',
'2022-09-28T06:00:00.000Z',
]);
const dateChange = (args: any) => {
console.log('dateChange.args.value: ', args.value)
setDate(args.value);
};
return (
<div>
<Datepicker
select="range"
// timezonePlugin={luxonTimezone}
// dataTimezone="utc"
// displayTimezone="America/Los_Angeles"
controls={['datetime']}
touchUi={true}
onChange={dateChange}
value={date}
/>
</div>
);
};
In the example below, the initial date is changed to an empty array:
import React from 'react';
import { Datepicker, luxonTimezone } from '@mobiscroll/react';
import * as luxon from 'luxon';
luxonTimezone.luxon = luxon;
export const MobiscrollDemo = () => {
const [date, setDate] = React.useState([
'2022-09-28T05:00:00.000Z',
'2022-09-28T06:00:00.000Z',
]);
const dateChange = (args: any) => {
console.log('dateChange.args.value: ', args.value)
setDate(args.value);
};
return (
<div>
<Datepicker
select="range"
timezonePlugin={luxonTimezone}
dataTimezone="utc"
displayTimezone="America/Los_Angeles"
controls={['datetime']}
touchUi={true}
onChange={dateChange}
value={date}
/>
</div>
);
};