+
{
+ try {
+ const [y, m, d] = String(date).split('-');
+ return `${d}/${m}/${y}`;
+ } catch (e) {
+ return '';
+ }
+ })() : ''}
+ readOnly
+ />
+ {showDatePicker && (
+
+ {
+ try {
+ const [y, m, d] = String(date).split('-').map(Number);
+ return new Date(y, m - 1, d);
+ } catch (e) {
+ return undefined;
+ }
+ })() : undefined}
+ onSelect={(selectedDate) => {
+ if (selectedDate) {
+ const y = selectedDate.getFullYear();
+ const m = String(selectedDate.getMonth() + 1).padStart(2, '0');
+ const d = String(selectedDate.getDate()).padStart(2, '0');
+ const dateStr = `${y}-${m}-${d}`;
+ setDate(dateStr);
+ setShowDatePicker(false);
+ }
+ }}
+ disabled={(checkDate) => {
+ const today = new Date();
+ today.setHours(0, 0, 0, 0);
+ return checkDate < today;
+ }}
+ />
+
+ )}
+