<script>
import Textfield, { Input, Textarea } from '@smui/textfield'
const current_date_less_1_week = new Date(new Date().setDate(new Date().getDate() - 7))
const current_date_plus_1_year = new Date(new Date().setFullYear(new Date().getFullYear() + 1))
const min = current_date_less_1_week.toISOString().slice(0, 10)
const max = current_date_plus_1_year.toISOString().slice(0, 10)
const date_props = {
min,
max,
}
let value = '' // '2022-04-01'
$: console.log(value, typeof value)
</script>
<p>Try to enter the date {new Date().toLocaleDateString()}.</p>
<label
>
No min or max (working):<br/>
<input bind:value={value} type='date' />
</label>
<label
>
<code>min={min} max={max}</code> (working)<br/>
<input bind:value={value} min={min} max={max} type='date' />
</label>
<label
>
<code>{'{...'}{JSON.stringify(date_props)}}</code> (broken)<br/>
<input bind:value={value} {...date_props} type='date' />