@icvdeveloper/common-module 0.1.3 → 1.0.0
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/CHANGELOG.md
CHANGED
package/dist/module.json
CHANGED
|
@@ -8,6 +8,7 @@ import { useClassBinding } from "../../composables/useClassBinding";
|
|
|
8
8
|
|
|
9
9
|
interface Props {
|
|
10
10
|
date: string;
|
|
11
|
+
timezone: string;
|
|
11
12
|
isCompact?: boolean;
|
|
12
13
|
showDays?: boolean;
|
|
13
14
|
showHours?: boolean;
|
|
@@ -49,6 +50,10 @@ const {
|
|
|
49
50
|
|
|
50
51
|
const { classBinding } = useClassBinding();
|
|
51
52
|
|
|
53
|
+
const eventDate: DateTime = DateTime.fromSQL(props.date, {
|
|
54
|
+
zone: props.timezone,
|
|
55
|
+
});
|
|
56
|
+
|
|
52
57
|
// reactive data
|
|
53
58
|
const isCounting = ref<boolean>(true);
|
|
54
59
|
const days = ref<number>(0);
|
|
@@ -82,14 +87,19 @@ const fontClass = computed(() => {
|
|
|
82
87
|
|
|
83
88
|
// methods
|
|
84
89
|
const updateCountdown = () => {
|
|
85
|
-
if (
|
|
90
|
+
if (
|
|
91
|
+
DateTime.fromSQL(props.date, { zone: props.timezone }).toLocal().diffNow()
|
|
92
|
+
.milliseconds < 0
|
|
93
|
+
) {
|
|
86
94
|
isCounting.value = false;
|
|
87
95
|
emit("complete");
|
|
88
96
|
clearInterval(loopTimer.value);
|
|
89
97
|
return;
|
|
90
98
|
}
|
|
91
99
|
|
|
92
|
-
|
|
100
|
+
const diffObj = DateTime.fromSQL(props.date, { zone: props.timezone })
|
|
101
|
+
.toLocal()
|
|
102
|
+
.diffNow(["days", "hours", "minutes", "seconds", "milliseconds"]);
|
|
93
103
|
|
|
94
104
|
days.value = diffObj.days;
|
|
95
105
|
hours.value = diffObj.hours;
|
|
@@ -139,7 +149,7 @@ onUnmounted(() => {
|
|
|
139
149
|
)
|
|
140
150
|
"
|
|
141
151
|
>
|
|
142
|
-
{{
|
|
152
|
+
{{ isCounting ? "event begins" : eventHasBegunText }}
|
|
143
153
|
</h1>
|
|
144
154
|
</div>
|
|
145
155
|
|