Skip to content

Commit

Permalink
add id (#77)
Browse files Browse the repository at this point in the history
  • Loading branch information
portfolioris authored Nov 15, 2023
1 parent c8f879f commit b738c7e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/lib/DateInput.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
export let min = new Date(defaultDate.getFullYear() - 20, 0, 1)
/** The latest value the user can select */
export let max = new Date(defaultDate.getFullYear(), 11, 31, 23, 59, 59, 999)
/** optional id attribute */
export let id = ''
/** Placeholder text to show when input field is empty */
export let placeholder = '2020-12-31 23:00:00'
/** Whether the text is valid */
Expand Down Expand Up @@ -189,6 +191,7 @@
class:invalid={!valid}
type="text"
value={text}
id={id || null}
{placeholder}
{disabled}
{required}
Expand Down
1 change: 0 additions & 1 deletion src/lib/DatePicker.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
/** Show a time picker with the specified precision */
export let timePrecision: 'minute' | 'second' | 'millisecond' | null = null
/** The earliest year the user can select */
export let min = new Date(defaultDate.getFullYear() - 20, 0, 1)
/** The latest year the user can select */
Expand Down
3 changes: 3 additions & 0 deletions src/routes/DateInput.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import Prop from './prop.svelte'
import Split from './split.svelte'
let id: string
let placeholder: string
let value: Date
let min: Date
Expand All @@ -21,6 +22,7 @@
<Split>
<DateInput
slot="left"
bind:id
bind:value
bind:min
bind:max
Expand All @@ -41,6 +43,7 @@
<Prop label="value">{value}</Prop>
<Prop label="min" bind:value={min} />
<Prop label="max" bind:value={max} />
<Prop label="id" bind:value={id} />
<Prop label="placeholder" bind:value={placeholder} />
<Prop label="valid" bind:value={valid} />
<Prop label="format" bind:value={format} />
Expand Down

0 comments on commit b738c7e

Please sign in to comment.