address breaking changes

This commit is contained in:
Thomas Ruoff
2022-03-14 22:35:30 +01:00
committed by Thomas Ruoff
parent 8222e04880
commit ef7f80fd92
10 changed files with 41 additions and 46 deletions

View File

@@ -3,19 +3,20 @@ import { BookContext } from '../../context/book'
import InputWrapper from '../inputWrapper'
import Input from '../input'
import Calendar from '../calendar'
import { dateFormatBackend } from '../../helpers/date'
export default function DateSelect() {
const { onChangeEvent, onChange, state } = useContext(BookContext)
const { startDate, endDate } = state.formData
const today = new Date().toISOString().substring(0, 10)
const today = dateFormatBackend(new Date())
return (
<>
<InputWrapper label="Datum" required>
<Calendar
start={startDate}
end={endDate}
start={dateFormatBackend(startDate)}
end={dateFormatBackend(endDate)}
onChange={onChange}
className="my-6 max-w-lg"
/>
@@ -27,7 +28,7 @@ export default function DateSelect() {
type="date"
className=""
name="startDate"
value={startDate || ''}
value={dateFormatBackend(startDate) || ''}
onChange={onChangeEvent}
min={today}
required
@@ -40,10 +41,10 @@ export default function DateSelect() {
type="date"
className=""
name="endDate"
value={endDate || ''}
value={dateFormatBackend(endDate) || ''}
placeholder="Von"
onChange={onChangeEvent}
min={startDate || today}
min={dateFormatBackend(startDate) || today}
/>
</div>
</div>