area17 / twill

Twill is an open source CMS toolkit for Laravel that helps developers rapidly create a custom admin console that is intuitive, powerful and flexible. Chat with us on Discord at https://discord.gg/cnWk7EFv8R.
https://twillcms.com
Apache License 2.0
3.75k stars 572 forks source link

fix: error with time-picker when allowInput is true #2576

Closed zeezo887 closed 4 months ago

zeezo887 commented 5 months ago

Description

The error occurs because the parseDate function cannot return a valid date for a time string e.g 12:00 AM. The change introduced in this PR appends the time to the current date string so that the function can return a valid date.

if (self.isValidTime(date)) {
  const currentDate = new Date();
  date = `${currentDate.toDateString()} ${date}`;
}

Related Issues

Fixes #2557