accomadesc 0.3.32 → 0.3.33
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,6 +10,7 @@
|
|
|
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';
|
|
13
14
|
|
|
14
15
|
const {
|
|
15
16
|
endpoint,
|
|
@@ -81,6 +82,20 @@
|
|
|
81
82
|
inputDatesEngaged = false;
|
|
82
83
|
};
|
|
83
84
|
|
|
85
|
+
let travelDates = $derived.by(() => {
|
|
86
|
+
if (arrival && leave) {
|
|
87
|
+
if (formatDateFunc) {
|
|
88
|
+
return `${formatDateFunc(arrival)} - ${formatDateFunc(leave)}`;
|
|
89
|
+
} else {
|
|
90
|
+
const formattedArrival = arrival.toFormat('yyyy-MM-dd');
|
|
91
|
+
const formattedLeave = leave.toFormat('yyyy-MM-dd');
|
|
92
|
+
return `${formattedArrival} - ${formattedLeave}`;
|
|
93
|
+
}
|
|
94
|
+
} else {
|
|
95
|
+
return '';
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
|
|
84
99
|
const createRequest = async (e: SubmitEvent) => {
|
|
85
100
|
sending = true;
|
|
86
101
|
e.preventDefault();
|
|
@@ -111,7 +126,11 @@
|
|
|
111
126
|
console.log('Error sending request', e);
|
|
112
127
|
}
|
|
113
128
|
|
|
129
|
+
arrival = undefined;
|
|
130
|
+
leave = undefined;
|
|
131
|
+
inputDatesEngaged = false;
|
|
114
132
|
sending = false;
|
|
133
|
+
|
|
115
134
|
setTimeout(() => {
|
|
116
135
|
errored = false;
|
|
117
136
|
successfullySent = false;
|
|
@@ -170,9 +189,7 @@
|
|
|
170
189
|
iconName="edit"
|
|
171
190
|
size={1.8}
|
|
172
191
|
clicked={engageDateInput}
|
|
173
|
-
text={
|
|
174
|
-
? `${formatDateFunc(arrival)} - ${formatDateFunc(leave)}`
|
|
175
|
-
: ''}
|
|
192
|
+
text={travelDates}
|
|
176
193
|
/>
|
|
177
194
|
{#if arrival && leave}
|
|
178
195
|
<Button iconName="delete" size={1.8} clicked={dateDeleted} />
|
|
@@ -205,7 +205,6 @@
|
|
|
205
205
|
<div class="wrapper">
|
|
206
206
|
<section class="occuplan-wrapper" style="max-width: {maxWidth}; width: 100%;">
|
|
207
207
|
<header class="occupation-plan-header">
|
|
208
|
-
{rfMonth}
|
|
209
208
|
<div class="header-controls">
|
|
210
209
|
{#if rfMonth >= minDate}
|
|
211
210
|
<Button text={prevPage} clicked={prevClicked} preventDefault={true} />
|
|
@@ -77,7 +77,6 @@ export const firstMonthValid = (value) => {
|
|
|
77
77
|
};
|
|
78
78
|
export const realFirstMonth = (firstMonth, firstMonthYear, numberOfMonth, page) => {
|
|
79
79
|
const monthToAdd = page * numberOfMonth;
|
|
80
|
-
console.log(firstMonth, firstMonthYear, numberOfMonth, page);
|
|
81
80
|
if (typeof firstMonth === 'number') {
|
|
82
81
|
const intValue = firstMonth;
|
|
83
82
|
if (intValue >= 1 && intValue <= 12) {
|