accomadesc 0.3.33 → 0.3.35

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.
@@ -10,7 +10,6 @@
10
10
  import { fade } from 'svelte/transition';
11
11
  import type { DateTime } from 'luxon';
12
12
  import { randomID } from './names/gen.js';
13
- import { format } from './helpers/format.ts';
14
13
 
15
14
  const {
16
15
  endpoint,
@@ -58,7 +57,7 @@
58
57
 
59
58
  let occupationState: OccupationState = getOccupationState(calUrl);
60
59
  let invalid = $derived(
61
- occupationState && arrival && leave ? occupationState.validRequest(arrival, leave) : false,
60
+ occupationState && arrival && leave ? !occupationState.validRequest(arrival, leave) : false,
62
61
  );
63
62
  const messageChanged = (value: string) => {
64
63
  message = value;
@@ -128,6 +127,9 @@
128
127
 
129
128
  arrival = undefined;
130
129
  leave = undefined;
130
+ email = '';
131
+ name = '';
132
+ message = '';
131
133
  inputDatesEngaged = false;
132
134
  sending = false;
133
135
 
@@ -72,6 +72,9 @@
72
72
  errored = true;
73
73
  }
74
74
  sending = false;
75
+ email = '';
76
+ name = '';
77
+ question = '';
75
78
 
76
79
  setTimeout(() => {
77
80
  errored = false;
@@ -79,16 +79,26 @@ const getDate = (icsLine) => {
79
79
  //e.g. DTEND;VALUE=DATE:20260818
80
80
  const [typePart, valuePart] = icsLine.split('=');
81
81
  const dateString = valuePart.split(':')[1];
82
- let rawDateTime = lx.fromISO(dateString);
82
+ //console.log(dateString);
83
+ const year = parseInt(dateString.slice(0, 4));
84
+ const month = parseInt(dateString.slice(4, 6));
85
+ const day = parseInt(dateString.slice(6, 8));
86
+ let rawDateTime = lx.utc().set({
87
+ year: year, month: month, day: day,
88
+ hour: 12, minute: 0, second: 0, millisecond: 0
89
+ });
90
+ return rawDateTime;
83
91
  //end date has to be moved back when whole day ending
84
- if (/^DTEND;VALUE$/.test(typePart)) {
85
- if (rawDateTime.hour == 0 &&
86
- rawDateTime.minute == 0 &&
87
- rawDateTime.second == 0 &&
88
- rawDateTime.millisecond == 0) {
89
- rawDateTime = rawDateTime.plus({ hour: 12 });
90
- }
91
- }
92
- //normalize to noon
93
- return rawDateTime.set({ hour: 12, minute: 0, second: 0, millisecond: 0 });
92
+ //if (/^DTEND;VALUE$/.test(typePart)) {
93
+ // if (
94
+ // rawDateTime.hour == 0 &&
95
+ // rawDateTime.minute == 0 &&
96
+ // rawDateTime.second == 0 &&
97
+ // rawDateTime.millisecond == 0
98
+ // ) {
99
+ // rawDateTime = rawDateTime.plus({ hour: 12 });
100
+ // }
101
+ //}
102
+ ////normalize to noon
103
+ //return rawDateTime.set({ hour: 12, minute: 0, second: 0, millisecond: 0 });
94
104
  };
@@ -324,7 +324,8 @@ export class OccupationState {
324
324
  };
325
325
  validRequest = (from, to) => {
326
326
  //TODO take min nights into account
327
- return !this.occupations.find((o) => o.arrival < to && o.leave > from);
327
+ const found = this.occupations.find((o) => o.arrival < to && o.leave > from);
328
+ return !found;
328
329
  };
329
330
  occupationStyle = (d, highlightWeekend = false, maxDate) => {
330
331
  const valid = validDay(d);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "accomadesc",
3
- "version": "0.3.33",
3
+ "version": "0.3.35",
4
4
  "files": [
5
5
  "dist",
6
6
  "!dist/**/*.test.*",