fuma 0.3.45 → 0.3.47
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.
- package/dist/ui/input/InputTime.svelte +0 -1
- package/dist/ui/period/PeriodPicker.svelte +14 -3
- package/dist/ui/period/PeriodPickerButton.svelte +0 -1
- package/dist/ui/table/head/TableHeadDate.svelte +2 -2
- package/dist/ui/table/head/TableHeadDate.svelte.d.ts +1 -1
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.js +0 -1
- package/package.json +1 -1
- package/dist/utils/time.d.ts +0 -2
- package/dist/utils/time.js +0 -13
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
<script>import { onMount, onDestroy, createEventDispatcher } from "svelte";
|
|
2
|
-
import dayjs from "dayjs";
|
|
3
2
|
export let numberOfMonths = 3;
|
|
4
3
|
export let numberOfColumns = numberOfMonths;
|
|
5
4
|
export let showWeekNumbers = true;
|
|
@@ -34,15 +33,27 @@ async function initTimePicker() {
|
|
|
34
33
|
endDate: period?.end ?? void 0,
|
|
35
34
|
setup: (picker2) => {
|
|
36
35
|
picker2.on("selected", (date1, date2) => {
|
|
36
|
+
const start = `${getAbsoluteDate(date1.dateInstance)}T${getAbsoluteTime(period?.start)}`;
|
|
37
|
+
console.log(start);
|
|
37
38
|
period = {
|
|
38
|
-
start:
|
|
39
|
-
|
|
39
|
+
start: /* @__PURE__ */ new Date(
|
|
40
|
+
`${getAbsoluteDate(date1.dateInstance)}T${getAbsoluteTime(period?.start)}`
|
|
41
|
+
),
|
|
42
|
+
end: /* @__PURE__ */ new Date(`${getAbsoluteDate(date2.dateInstance)}T${getAbsoluteTime(period?.end)}`)
|
|
40
43
|
};
|
|
44
|
+
console.log(period);
|
|
41
45
|
dispatch("change", period);
|
|
42
46
|
});
|
|
43
47
|
}
|
|
44
48
|
});
|
|
45
49
|
}
|
|
50
|
+
const getAbsoluteDate = (date) => [date.getFullYear(), date.getMonth() + 1, date.getDate()].map((n) => n.toString().padStart(2, "0")).join("-");
|
|
51
|
+
const getAbsoluteTime = (date) => {
|
|
52
|
+
if (!date)
|
|
53
|
+
return "00:00:00";
|
|
54
|
+
console.log(date.getHours());
|
|
55
|
+
return [date.getHours(), date.getMinutes(), date.getSeconds()].map((n) => n.toString().padStart(2, "0")).join(":");
|
|
56
|
+
};
|
|
46
57
|
</script>
|
|
47
58
|
|
|
48
59
|
<input type="hidden" bind:this={startElement} />
|
|
@@ -7,7 +7,6 @@ import { Icon } from "../icon/index.js";
|
|
|
7
7
|
import { DropDown } from "../menu/index.js";
|
|
8
8
|
import { InputTime } from "../input/index.js";
|
|
9
9
|
import { PeriodPicker } from "./index.js";
|
|
10
|
-
import { msToTime, timeToMs } from "../../utils/time.js";
|
|
11
10
|
import dayjs from "dayjs";
|
|
12
11
|
let dropDown;
|
|
13
12
|
const start = $page.url.searchParams.get("start");
|
|
@@ -29,8 +29,8 @@ function handleSubmit() {
|
|
|
29
29
|
$urlParam.with(
|
|
30
30
|
{
|
|
31
31
|
[field.key]: JSON.stringify({
|
|
32
|
-
start:
|
|
33
|
-
end:
|
|
32
|
+
start: period.start?.toJSON(),
|
|
33
|
+
end: period.end?.toJSON()
|
|
34
34
|
})
|
|
35
35
|
},
|
|
36
36
|
"skip",
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
package/package.json
CHANGED
package/dist/utils/time.d.ts
DELETED
package/dist/utils/time.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export function msToTime(ms) {
|
|
2
|
-
if (ms === null || ms === undefined)
|
|
3
|
-
return '';
|
|
4
|
-
const hours = Math.floor(ms / (1000 * 60 * 60));
|
|
5
|
-
const minutes = Math.floor(ms / (1000 * 60) - hours * 60);
|
|
6
|
-
const secondes = Math.floor(ms / 1000 - minutes * 60 - hours * 60 * 60);
|
|
7
|
-
const format = (n) => n.toString().padStart(2, '0');
|
|
8
|
-
return [format(hours % 24), format(minutes), format(secondes)].join(':');
|
|
9
|
-
}
|
|
10
|
-
export function timeToMs(time) {
|
|
11
|
-
const [h = 0, m = 0, s = 0] = time.split(':').map((s) => +s);
|
|
12
|
-
return (h * 60 * 60 + m * 60 + s) * 1000;
|
|
13
|
-
}
|