fuma 0.3.46 → 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.
@@ -33,19 +33,27 @@ async function initTimePicker() {
33
33
  endDate: period?.end ?? void 0,
34
34
  setup: (picker2) => {
35
35
  picker2.on("selected", (date1, date2) => {
36
- const [startDate] = date1.dateInstance.toJSON().split("T");
37
- const [endDate] = date2.dateInstance.toJSON().split("T");
38
- const startTime = period?.start?.toJSON().split("T").at(1) || "00:00";
39
- const endTime = period?.end?.toJSON().split("T").at(1) || "00:00";
36
+ const start = `${getAbsoluteDate(date1.dateInstance)}T${getAbsoluteTime(period?.start)}`;
37
+ console.log(start);
40
38
  period = {
41
- start: /* @__PURE__ */ new Date(`${startDate}T${startTime}`),
42
- end: /* @__PURE__ */ new Date(`${endDate}T${endTime}`)
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)}`)
43
43
  };
44
+ console.log(period);
44
45
  dispatch("change", period);
45
46
  });
46
47
  }
47
48
  });
48
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
+ };
49
57
  </script>
50
58
 
51
59
  <input type="hidden" bind:this={startElement} />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fuma",
3
- "version": "0.3.46",
3
+ "version": "0.3.47",
4
4
  "description": "My fullstack material build with sveltekit, daisyui, zod, prisma, lucia",
5
5
  "author": {
6
6
  "name": "Jonas Voisard",