refactor: Update date input fields with min and max values

This commit is contained in:
Sean Morley
2024-07-31 11:01:41 -04:00
parent 4e44203239
commit 17498121a3
6 changed files with 45 additions and 2 deletions

View File

@@ -11,6 +11,17 @@
let originalName = transportationToEdit.name;
export let startDate: string | null = null;
export let endDate: string | null = null;
let fullStartDate: string = '';
let fullEndDate: string = '';
if (startDate && endDate) {
fullStartDate = `${startDate}T00:00`;
fullEndDate = `${endDate}T23:59`;
}
import MapMarker from '~icons/mdi/map-marker';
import Calendar from '~icons/mdi/calendar';
import Notebook from '~icons/mdi/notebook';
@@ -142,6 +153,8 @@
type="datetime-local"
id="date"
name="date"
min={fullStartDate || ''}
max={fullEndDate || ''}
bind:value={transportationToEdit.date}
class="input input-bordered w-full max-w-xs mt-1"
/>