accomadesc 0.1.44 → 0.2.0

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,16 @@
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
22
  </script>
23
23
 
24
24
  <div class="cal-wrapper">
25
25
  <OccuPlanWrapper
26
- minDate={DateTime.utc().set({ day: 1, month: 1, year: minYear })}
27
- maxDate={DateTime.utc().set({ day: 31, month: 12, year: maxYear })}
26
+ minDate={DateTime.utc().set({ day: 1, month: 1 }).minus({ year: maxPastYears })}
27
+ maxDate={DateTime.utc().set({ day: 31, month: 12 }).plus({ year: maxFutureYears })}
28
28
  {url}
29
29
  {debug}
30
30
  {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,8 @@
16
16
 
17
17
  let availHeader = $derived(translateFunc ? translateFunc('availability') : '[AVAILABILITY]');
18
18
 
19
+ const maxFutureDate = DateTime.utc().set({ day: 31, month: 12 }).plus({ years: maxFutureYears });
20
+
19
21
  const formatAvailability = (from: DateTime | null, forDays: number): string => {
20
22
  if (!formatFunc || !formatDateFunc) return '';
21
23
  if (from == null) {
@@ -36,7 +38,7 @@
36
38
  <div class="cal-wrapper">
37
39
  <h3>{availHeader}</h3>
38
40
 
39
- <OccuPlanAvailableInfo {debug} {search} {url}>
41
+ <OccuPlanAvailableInfo {debug} {search} {url} {maxFutureDate}>
40
42
  {#snippet children(av: AvailableSpans)}
41
43
  <ul>
42
44
  {#each search as s}
@@ -7,8 +7,8 @@
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
14
  </script>
@@ -17,8 +17,8 @@
17
17
  <OccuPlanGrid
18
18
  {url}
19
19
  {debug}
20
- minDate={DateTime.utc().set({ day: 1, month: 1, year: minYear })}
21
- maxDate={DateTime.utc().set({ day: 31, month: 12, year: maxYear })}
20
+ minDate={DateTime.utc().set({ day: 1, month: 1 }).minus({ year: maxPastYears })}
21
+ maxDate={DateTime.utc().set({ day: 31, month: 12 }).plus({ year: maxFutureYears })}
22
22
  header={translateFunc ? translateFunc('calendarHeader') : ''}
23
23
  {...calendarTranslation}
24
24
  />
@@ -7,8 +7,8 @@
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
14
  </script>
@@ -17,8 +17,8 @@
17
17
  <OccuPlanRows
18
18
  {url}
19
19
  {debug}
20
- minDate={DateTime.utc().set({ day: 1, month: 1, year: minYear })}
21
- maxDate={DateTime.utc().set({ day: 31, month: 12, year: maxYear })}
20
+ minDate={DateTime.utc().set({ day: 1, month: 1 }).minus({ years: maxPastYears })}
21
+ maxDate={DateTime.utc().set({ day: 31, month: 12 }).plus({ years: maxFutureYears })}
22
22
  header={translateFunc ? translateFunc('calendarHeader') : ''}
23
23
  {...calendarTranslation}
24
24
  />
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.0",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run package",