@veritree/ui 0.75.1-0 → 0.75.1-1

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": "@veritree/ui",
3
- "version": "0.75.1-0",
3
+ "version": "0.75.1-1",
4
4
  "description": "veritree ui library",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -2,7 +2,8 @@
2
2
  <VTPopover>
3
3
  <VTPopoverTrigger ref="trigger">
4
4
  <button :class="classComputed" :disabled="disabled">
5
- <span>{{ date }}</span>
5
+ <span v-if="date">{{ dateFormatted }}</span>
6
+ <span class="text-gray-500" v-else>yyyy-mm-dd</span>
6
7
  <span
7
8
  class="pointer-events-none absolute right-3 top-1/2 -translate-y-1/2"
8
9
  :class="[disabled ? 'bg-gray-100' : 'bg-white']"
@@ -60,12 +61,32 @@ export default {
60
61
  computed: {
61
62
  date: {
62
63
  get() {
63
- return this.value ? new Date(this.value).toLocaleDateString() : null;
64
+ return this.value;
64
65
  },
65
66
  set(newDate) {
66
67
  this.$emit('input', newDate);
67
68
  },
68
69
  },
70
+
71
+ /**
72
+ * Computed property to format the date in the yyyy-mm-dd format.
73
+ * @returns {string|null} The formatted date string in the yyyy-mm-dd format, or null if the date is not set.
74
+ */
75
+ dateFormatted() {
76
+ if (this.date) {
77
+ const [month, day, year] = new Date(this.value)
78
+ .toLocaleDateString('en-US', {
79
+ year: 'numeric',
80
+ month: '2-digit',
81
+ day: '2-digit',
82
+ })
83
+ .split('/');
84
+
85
+ return `${year}-${month}-${day}`;
86
+ }
87
+
88
+ return this.date;
89
+ },
69
90
  },
70
91
 
71
92
  methods: {