Skip to content

Commit

Permalink
fix: Resolved issues with the date pickers for Steam URL date ranges
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-coster committed Aug 29, 2024
1 parent 11ba95a commit 53267eb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 4 additions & 2 deletions packages/site/src/routes/steam-tools/components/Config.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,16 @@
<DateInput
name="fromDate"
date={$config.fromDate}
on:keyup={(e) => config.setField('fromDate', e.detail)}
on:change={(e) => {
config.setField('fromDate', e.detail);
}}
/>

<label for="toDate"> To </label>
<DateInput
name="toDate"
date={$config.toDate}
on:keyup={(e) => config.setField('toDate', e.detail)}
on:change={(e) => config.setField('toDate', e.detail)}
/>

<h3>Comparison Period</h3>
Expand Down
10 changes: 4 additions & 6 deletions packages/site/src/routes/steam-tools/components/DateInput.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
const dispatch = createEventDispatcher<{ change: Date | undefined }>();
let internalDate: string | undefined = dateToDateInputString(date);
// Convert a YYYY-MM-DD string to a Date object in the local timezone
function inputDateToDate(dateString: string | undefined) {
if (!dateString) return undefined;
Expand All @@ -20,13 +18,13 @@
}${offsetHours}:${offsetMinutes}`;
return new Date(asIsoString);
}
$: date = internalDate ? inputDateToDate(internalDate) : undefined;
</script>

<input
{name}
type="date"
bind:value={internalDate}
on:change={(e) => dispatch('change', inputDateToDate(e.currentTarget.value))}
value={dateToDateInputString(date)}
on:change={(e) => {
dispatch('change', inputDateToDate(e.currentTarget.value));
}}
/>

0 comments on commit 53267eb

Please sign in to comment.