Skip to content

Commit

Permalink
fix: date
Browse files Browse the repository at this point in the history
  • Loading branch information
alaca committed May 13, 2024
1 parent f4e6304 commit c5c88e1
Showing 1 changed file with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,10 @@ export default ({

const [date, setDate] = useState<string>(value);
const [isVisible, setIsVisible] = useState<boolean>(false);
const currentDate = date ? new Date(date) : new Date();


const convertJsDateToMySQLDate = (dateTime: string) => {
// split the ISO string into date and time
const [date, time] = new Date(dateTime).toISOString().split('T');

return `${date} ${time.slice(0, 8)}`;
const [date, time] = dateTime.split('T');
return `${date} ${time}`;
};

const toggleVisible = () => {
Expand Down Expand Up @@ -101,15 +97,15 @@ export default ({
{showTimeSelector ? (
<DateTimePicker
is12Hour={is12Hour}
currentDate={currentDate}
currentDate={value}
isInvalidDate={(date) => checkDate(date)}
onChange={(date) => {
setDate(date);
}}
/>
) : (
<DatePicker
currentDate={currentDate}
currentDate={value}
isInvalidDate={(date) => checkDate(date)}
onChange={(date) => {
setDate(date);
Expand Down

0 comments on commit c5c88e1

Please sign in to comment.