hamzus-ui 0.0.35 → 0.0.36

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hamzus-ui",
3
- "version": "0.0.35",
3
+ "version": "0.0.36",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "svelte": "index.js",
@@ -28,7 +28,7 @@
28
28
 
29
29
  let toggleDisplay;
30
30
 
31
- let labelMonth = "selectionner une date";
31
+ $: labelMonth = formatValue(value);
32
32
 
33
33
  let currentYear = new Date().getFullYear();
34
34
  let currentMonth = new Date().getMonth() + 1;
@@ -43,7 +43,20 @@
43
43
  return Array.from({ length: currentYear - startYear + 1 }, (_, i) => currentYear + 100 - i);
44
44
  }
45
45
 
46
- onMount(() => {});
46
+ function formatValue(value) {
47
+ if (value === "") {
48
+ return "selectionner une date"
49
+ }
50
+
51
+ const dateData = value.split("-")
52
+
53
+ const day = parseInt(dateData[2])
54
+ const month = parseInt(dateData[1])
55
+ const year = dateData[0]
56
+
57
+ return `${day} ${monthList[month]} ${currentYear}`
58
+
59
+ }
47
60
 
48
61
  function generateCalendarMatrix(year, month) {
49
62
  const firstDay = new Date(year, month, 1);
@@ -116,8 +129,6 @@
116
129
 
117
130
  value = `${currentYear}-${formatNumber(currentMonth)}-${formatNumber(day)}`
118
131
 
119
- labelMonth = `${day} ${monthList[currentMonth]} ${currentYear}`
120
-
121
132
  if (onChange !== undefined) {
122
133
  onChange(value)
123
134
  }