accomadesc 0.1.43 → 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.
@@ -1,6 +1,7 @@
1
1
  <script lang="ts">
2
2
  import OccuPlanWrapper from './occuplan/OccuPlanWrapper.svelte';
3
3
  import type { CalendarContent, I18nFacade } from './types.js';
4
+ import { DateTime } from 'luxon';
4
5
 
5
6
  let {
6
7
  url,
@@ -14,12 +15,16 @@
14
15
  rowsMonthNumbers,
15
16
  rowsFirstMonth,
16
17
  rowsMaxWidth,
18
+ maxPastYears = 0,
19
+ maxFutureYears = 2,
17
20
  translateFunc,
18
21
  }: CalendarContent & I18nFacade & { debug?: boolean } = $props();
19
22
  </script>
20
23
 
21
24
  <div class="cal-wrapper">
22
25
  <OccuPlanWrapper
26
+ minDate={DateTime.utc().set({ day: 1, month: 1 }).minus({ year: maxPastYears })}
27
+ maxDate={DateTime.utc().set({ day: 31, month: 12 }).plus({ year: maxFutureYears })}
23
28
  {url}
24
29
  {debug}
25
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}
@@ -1,11 +1,14 @@
1
1
  <script lang="ts">
2
2
  import type { CalendarGridContent, I18nFacade } from './types.js';
3
3
  import OccuPlanGrid from './occuplan/OccuPlanGrid.svelte';
4
+ import { DateTime } from 'luxon';
4
5
 
5
6
  let {
6
7
  url,
7
8
  debug = false,
8
9
  calendarTranslation,
10
+ maxPastYears = 0,
11
+ maxFutureYears = 2,
9
12
  translateFunc,
10
13
  }: CalendarGridContent & I18nFacade & { debug?: boolean } = $props();
11
14
  </script>
@@ -14,6 +17,8 @@
14
17
  <OccuPlanGrid
15
18
  {url}
16
19
  {debug}
20
+ minDate={DateTime.utc().set({ day: 1, month: 1 }).minus({ year: maxPastYears })}
21
+ maxDate={DateTime.utc().set({ day: 31, month: 12 }).plus({ year: maxFutureYears })}
17
22
  header={translateFunc ? translateFunc('calendarHeader') : ''}
18
23
  {...calendarTranslation}
19
24
  />
@@ -1,11 +1,14 @@
1
1
  <script lang="ts">
2
2
  import type { CalendarRowsContent, I18nFacade } from './types.js';
3
3
  import OccuPlanRows from './occuplan/OccuPlanRows.svelte';
4
+ import { DateTime } from 'luxon';
4
5
 
5
6
  let {
6
7
  url,
7
8
  debug,
8
9
  calendarTranslation,
10
+ maxPastYears = 0,
11
+ maxFutureYears = 2,
9
12
  translateFunc,
10
13
  }: CalendarRowsContent & I18nFacade & { debug?: boolean } = $props();
11
14
  </script>
@@ -14,6 +17,8 @@
14
17
  <OccuPlanRows
15
18
  {url}
16
19
  {debug}
20
+ minDate={DateTime.utc().set({ day: 1, month: 1 }).minus({ years: maxPastYears })}
21
+ maxDate={DateTime.utc().set({ day: 31, month: 12 }).plus({ years: maxFutureYears })}
17
22
  header={translateFunc ? translateFunc('calendarHeader') : ''}
18
23
  {...calendarTranslation}
19
24
  />
package/dist/types.d.ts CHANGED
@@ -39,6 +39,8 @@ export interface CalendarContent {
39
39
  rowsMonthNumbers?: number;
40
40
  rowsFirstMonth?: FirstMonth;
41
41
  rowsMaxWidth?: string;
42
+ maxFutureYears?: number;
43
+ maxPastYears?: number;
42
44
  }
43
45
  export interface CalendarAvailable {
44
46
  id: string;
@@ -48,7 +50,7 @@ export interface CalendarAvailable {
48
50
  export interface CalendarAvailableContent {
49
51
  url: string;
50
52
  search: number[];
51
- maxFutureDate?: string;
53
+ maxFutureYears?: number;
52
54
  }
53
55
  export interface CalendarGrid {
54
56
  id: string;
@@ -57,8 +59,8 @@ export interface CalendarGrid {
57
59
  }
58
60
  export interface CalendarGridContent {
59
61
  url: string;
60
- maxYear?: number;
61
- minYear?: number;
62
+ maxFutureYears?: number;
63
+ maxPastYears?: number;
62
64
  }
63
65
  export interface CalendarRows {
64
66
  id: string;
@@ -67,8 +69,8 @@ export interface CalendarRows {
67
69
  }
68
70
  export interface CalendarRowsContent {
69
71
  url: string;
70
- maxYear?: number;
71
- minYear?: number;
72
+ maxFutureYears?: number;
73
+ maxPastYears?: number;
72
74
  }
73
75
  export interface Text {
74
76
  id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "accomadesc",
3
- "version": "0.1.43",
3
+ "version": "0.2.0",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run package",