edwardfxiao / react-minimal-datetime-range

A react component for date time range picker. Online demo examples
https://edwardfxiao.github.io/react-minimal-datetime-range/
MIT License
16 stars 7 forks source link

Datetime range dd/mm/yyyy format #2

Closed luizabentivoglio closed 2 years ago

luizabentivoglio commented 3 years ago

Hi, how can i use the dd/mm/yyyy format on datetime range?

edwardfxiao commented 2 years ago

Sorry, it does not support other formats. You can transform the value by dayjs or other libraries inside onConfirm.

import dayjs from 'dayjs';

<...
onConfirm={res => {
  // do your transformation here with the res
  // res looks like ['2021-10-13 01:01', '2021-11-24 01:01']
  const start = res[0];
  const end = res[1];
  const myFormattedStart = dayjs(start).format('dd/mm/yyyy');
  const myFormattedEnd= dayjs(end).format('dd/mm/yyyy');
}}
...
/>

Something like that