Skip to content
This repository has been archived by the owner on Jun 25, 2024. It is now read-only.

Commit

Permalink
Add a event dispatcher to the date picker
Browse files Browse the repository at this point in the history
  • Loading branch information
Dlurak committed Jan 27, 2024
1 parent 2fe678b commit f599b2e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/lib/dates/DatePicker.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
} from '$lib/calendar/utils';
import I18n from '$lib/I18n.svelte';
import type { IntRange } from '../../types/utils';
import { createEventDispatcher } from 'svelte';
const currentDate = new Date();
Expand All @@ -28,6 +29,8 @@
month: displayMonth,
year: displayYear
});
const dispatch = createEventDispatcher();
</script>

<button on:click={() => (isPicking = !isPicking)} type="button">
Expand Down Expand Up @@ -72,6 +75,7 @@
on:click={() => {
dateObj = getDisplayObj(i + 1);
isPicking = false;
dispatch('input', dateObj);
}}
class={JSON.stringify(getDisplayObj(i + 1)) === JSON.stringify(dateObj)
? 'rounded-full bg-light-secondary dark:bg-dark-secondary p-1'
Expand Down
1 change: 0 additions & 1 deletion src/lib/homework/CreateHomework.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<script lang="ts">
import DatePicker from '../dates/DatePicker.svelte';
import { page } from '$app/stores';
import SubmitButton from '$lib/SubmitButton.svelte';
import { createDate } from '$lib/dates/createDateObject';
Expand Down

0 comments on commit f599b2e

Please sign in to comment.