@kiva/kv-components 3.29.0 → 3.30.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
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [3.30.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.29.0...@kiva/kv-components@3.30.0) (2023-07-17)
7
+
8
+
9
+ ### Features
10
+
11
+ * cover the expired edge case ([4e97abf](https://github.com/kiva/kv-ui-elements/commit/4e97abfab4019f08632666f34a931d8a2f89e6d2))
12
+
13
+
14
+
15
+
16
+
6
17
  # [3.29.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.28.0...@kiva/kv-components@3.29.0) (2023-07-14)
7
18
 
8
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiva/kv-components",
3
- "version": "3.29.0",
3
+ "version": "3.30.0",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -75,5 +75,5 @@
75
75
  "optional": true
76
76
  }
77
77
  },
78
- "gitHead": "c6cb925341942eed7b7e89a469e1b6bd0878af27"
78
+ "gitHead": "d54d59bf1bedf3e18841138aac0b4dc7f58679be"
79
79
  }
@@ -29,19 +29,23 @@ export default {
29
29
  onMounted(() => {
30
30
  timeLeft.value = moment.duration(msLeft.value > 0 ? msLeft.value : 0, 'milliseconds');
31
31
 
32
- const countdownInterval = 1000;
32
+ if (timeLeft.value > 0) {
33
+ const countdownInterval = 1000;
33
34
 
34
- interval.value = setInterval(() => {
35
- timeLeft.value = moment.duration(timeLeft.value - countdownInterval, 'milliseconds');
35
+ interval.value = setInterval(() => {
36
+ timeLeft.value = moment.duration(timeLeft.value - countdownInterval, 'milliseconds');
36
37
 
37
- if (timeLeft.value <= 0) {
38
- clearInterval(interval.value);
39
- }
40
- }, countdownInterval);
38
+ if (timeLeft.value <= 0) {
39
+ clearInterval(interval.value);
40
+ }
41
+ }, countdownInterval);
42
+ }
41
43
  });
42
44
 
43
45
  onBeforeUnmount(() => {
44
- clearInterval(interval.value);
46
+ if (interval.value) {
47
+ clearInterval(interval.value);
48
+ }
45
49
  });
46
50
 
47
51
  return { timeLeft };
@@ -25,3 +25,5 @@ export const Seconds = story({ msLeft: 1000 * 10 });
25
25
 
26
26
  // One second less than 24 hours (since we don't show days in timer)
27
27
  export const Tomorrow = story({ msLeft: 1000 * 60 * 60 * 24 - 1000 });
28
+
29
+ export const Expired = story({ msLeft: 0 });