accomadesc 0.1.44 → 0.2.1

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.
@@ -15,16 +15,19 @@
15
15
  rowsMonthNumbers,
16
16
  rowsFirstMonth,
17
17
  rowsMaxWidth,
18
- minYear = DateTime.utc().year,
19
- maxYear = DateTime.utc().plus({ year: 2 }).year,
18
+ maxPastYears = 0,
19
+ maxFutureYears = 2,
20
20
  translateFunc,
21
21
  }: CalendarContent & I18nFacade & { debug?: boolean } = $props();
22
+
23
+ let minDate = $derived(DateTime.utc().minus({ year: maxPastYears }));
24
+ let maxDate = $derived(DateTime.utc().plus({ year: maxFutureYears }));
22
25
  </script>
23
26
 
24
27
  <div class="cal-wrapper">
25
28
  <OccuPlanWrapper
26
- minDate={DateTime.utc().set({ day: 1, month: 1, year: minYear })}
27
- maxDate={DateTime.utc().set({ day: 31, month: 12, year: maxYear })}
29
+ {minDate}
30
+ {maxDate}
28
31
  {url}
29
32
  {debug}
30
33
  {toggleGridOffset}
@@ -8,7 +8,7 @@
8
8
  url,
9
9
  debug = true,
10
10
  search = [3, 7, 14],
11
- maxFutureDate = DateTime.now().plus({ years: 2 }).toISO(),
11
+ maxFutureYears = 2,
12
12
  formatDateFunc,
13
13
  formatFunc,
14
14
  translateFunc,
@@ -16,6 +16,10 @@
16
16
 
17
17
  let availHeader = $derived(translateFunc ? translateFunc('availability') : '[AVAILABILITY]');
18
18
 
19
+ let maxFutureDate = $derived(
20
+ DateTime.utc().set({ day: 31, month: 12 }).plus({ years: maxFutureYears }),
21
+ );
22
+
19
23
  const formatAvailability = (from: DateTime | null, forDays: number): string => {
20
24
  if (!formatFunc || !formatDateFunc) return '';
21
25
  if (from == null) {
@@ -36,7 +40,7 @@
36
40
  <div class="cal-wrapper">
37
41
  <h3>{availHeader}</h3>
38
42
 
39
- <OccuPlanAvailableInfo {debug} {search} {url}>
43
+ <OccuPlanAvailableInfo {debug} {search} {url} {maxFutureDate}>
40
44
  {#snippet children(av: AvailableSpans)}
41
45
  <ul>
42
46
  {#each search as s}
@@ -7,18 +7,21 @@
7
7
  url,
8
8
  debug = false,
9
9
  calendarTranslation,
10
- minYear = DateTime.utc().year,
11
- maxYear = DateTime.utc().plus({ year: 2 }).year,
10
+ maxPastYears = 0,
11
+ maxFutureYears = 2,
12
12
  translateFunc,
13
13
  }: CalendarGridContent & I18nFacade & { debug?: boolean } = $props();
14
+
15
+ let minDate = $derived(DateTime.utc().minus({ year: maxPastYears }));
16
+ let maxDate = $derived(DateTime.utc().plus({ year: maxFutureYears }));
14
17
  </script>
15
18
 
16
19
  <div class="cal-wrapper">
17
20
  <OccuPlanGrid
18
21
  {url}
19
22
  {debug}
20
- minDate={DateTime.utc().set({ day: 1, month: 1, year: minYear })}
21
- maxDate={DateTime.utc().set({ day: 31, month: 12, year: maxYear })}
23
+ {minDate}
24
+ {maxDate}
22
25
  header={translateFunc ? translateFunc('calendarHeader') : ''}
23
26
  {...calendarTranslation}
24
27
  />
@@ -7,18 +7,20 @@
7
7
  url,
8
8
  debug,
9
9
  calendarTranslation,
10
- minYear = DateTime.utc().year,
11
- maxYear = DateTime.utc().plus({ year: 2 }).year,
10
+ maxPastYears = 0,
11
+ maxFutureYears = 2,
12
12
  translateFunc,
13
13
  }: CalendarRowsContent & I18nFacade & { debug?: boolean } = $props();
14
+ let minDate = $derived(DateTime.utc().minus({ year: maxPastYears }));
15
+ let maxDate = $derived(DateTime.utc().plus({ year: maxFutureYears }));
14
16
  </script>
15
17
 
16
18
  <div class="cal-wrapper">
17
19
  <OccuPlanRows
18
20
  {url}
19
21
  {debug}
20
- minDate={DateTime.utc().set({ day: 1, month: 1, year: minYear })}
21
- maxDate={DateTime.utc().set({ day: 31, month: 12, year: maxYear })}
22
+ {maxDate}
23
+ {minDate}
22
24
  header={translateFunc ? translateFunc('calendarHeader') : ''}
23
25
  {...calendarTranslation}
24
26
  />
package/dist/types.d.ts CHANGED
@@ -39,8 +39,8 @@ export interface CalendarContent {
39
39
  rowsMonthNumbers?: number;
40
40
  rowsFirstMonth?: FirstMonth;
41
41
  rowsMaxWidth?: string;
42
- maxYear?: number;
43
- minYear?: number;
42
+ maxFutureYears?: number;
43
+ maxPastYears?: number;
44
44
  }
45
45
  export interface CalendarAvailable {
46
46
  id: string;
@@ -50,7 +50,7 @@ export interface CalendarAvailable {
50
50
  export interface CalendarAvailableContent {
51
51
  url: string;
52
52
  search: number[];
53
- maxFutureDate?: string;
53
+ maxFutureYears?: number;
54
54
  }
55
55
  export interface CalendarGrid {
56
56
  id: string;
@@ -59,8 +59,8 @@ export interface CalendarGrid {
59
59
  }
60
60
  export interface CalendarGridContent {
61
61
  url: string;
62
- maxYear?: number;
63
- minYear?: number;
62
+ maxFutureYears?: number;
63
+ maxPastYears?: number;
64
64
  }
65
65
  export interface CalendarRows {
66
66
  id: string;
@@ -69,8 +69,8 @@ export interface CalendarRows {
69
69
  }
70
70
  export interface CalendarRowsContent {
71
71
  url: string;
72
- maxYear?: number;
73
- minYear?: number;
72
+ maxFutureYears?: number;
73
+ maxPastYears?: number;
74
74
  }
75
75
  export interface Text {
76
76
  id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "accomadesc",
3
- "version": "0.1.44",
3
+ "version": "0.2.1",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run package",