fuma 0.4.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,8 +14,8 @@ let dropDown;
14
14
  const start = $page.url.searchParams.get("start");
15
15
  const end = $page.url.searchParams.get("end");
16
16
  export let range = {
17
- start: start ? new Date(start) : null,
18
- end: end ? new Date(end) : null
17
+ start: start ? new Date(start) : void 0,
18
+ end: end ? new Date(end) : void 0
19
19
  };
20
20
  $:
21
21
  isValidPeriod = !!range.start && !!range.end;
@@ -38,7 +38,7 @@ function handleSubmit() {
38
38
  }
39
39
  function handleReset() {
40
40
  dropDown.hide();
41
- range = { start: null, end: null };
41
+ range = { start: void 0, end: void 0 };
42
42
  goto($urlParam.without("start", "end"), { replaceState: true, noScroll: true });
43
43
  }
44
44
  </script>
@@ -59,12 +59,34 @@ function handleReset() {
59
59
  <form class="flex flex-col" on:submit|preventDefault={handleSubmit} data-sveltekit-replacestate>
60
60
  <RangePicker numberOfMonths={1} bind:range {minDate} {maxDate} />
61
61
 
62
- <input class="hidden" type="text" name="start" value={range.start?.toJSON()} />
63
- <input class="hidden" type="text" name="end" value={range.end?.toJSON()} />
62
+ <input
63
+ class="hidden"
64
+ type="text"
65
+ name="start"
66
+ value={range.start ? dayjs(range.start).toJSON() : ''}
67
+ />
68
+ <input
69
+ class="hidden"
70
+ type="text"
71
+ name="end"
72
+ value={range.end ? dayjs(range.end).toJSON() : ''}
73
+ />
64
74
 
65
75
  <div class="flex gap-2 p-2">
66
- <InputTime label="A partir de" bind:value={range.start} enhanceDisabled class="grow" />
67
- <InputTime label="Jusqu'à" bind:value={range.end} enhanceDisabled class="grow" />
76
+ <InputTime
77
+ label="A partir de"
78
+ value={dayjs(range.start).toDate()}
79
+ on:input={({ detail: newDate }) => (range.start = newDate)}
80
+ enhanceDisabled
81
+ class="grow"
82
+ />
83
+ <InputTime
84
+ label="Jusqu'à"
85
+ value={dayjs(range.end).toDate()}
86
+ on:input={({ detail: newDate }) => (range.end = newDate)}
87
+ enhanceDisabled
88
+ class="grow"
89
+ />
68
90
  </div>
69
91
  <button class="btn m-2"> Valider </button>
70
92
  </form>
@@ -1,12 +1,10 @@
1
1
  import { SvelteComponent } from "svelte";
2
+ import { type Range } from './index.js';
2
3
  declare const __propDef: {
3
4
  props: {
4
5
  minDate?: Date | number | string | undefined;
5
6
  maxDate?: Date | number | string | undefined;
6
- range?: {
7
- start: Date | null;
8
- end: Date | null;
9
- } | undefined;
7
+ range?: Range | undefined;
10
8
  };
11
9
  events: {
12
10
  [evt: string]: CustomEvent<any>;
@@ -1,10 +1,10 @@
1
- import dayjs, { type ConfigType } from 'dayjs';
2
- export type RangeDate = ConfigType;
1
+ import { Dayjs } from 'dayjs';
2
+ export type RangeDate = Date | Dayjs | null | undefined;
3
3
  export type Range = {
4
4
  start: RangeDate;
5
5
  end: RangeDate;
6
6
  };
7
7
  export type RangeRequired = {
8
- start: string | number | Date | dayjs.Dayjs;
9
- end: string | number | Date | dayjs.Dayjs;
8
+ start: Date | Dayjs;
9
+ end: Date | Dayjs;
10
10
  };
@@ -1 +1 @@
1
- import dayjs, {} from 'dayjs';
1
+ import { Dayjs } from 'dayjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fuma",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "My fullstack material build with sveltekit, daisyui, zod, prisma, lucia",
5
5
  "author": {
6
6
  "name": "Jonas Voisard",