diff --git a/src/components/cards/PwcCard.vue b/src/components/cards/PwcCard.vue
index 4998f0cb..6c4cd7de 100644
--- a/src/components/cards/PwcCard.vue
+++ b/src/components/cards/PwcCard.vue
@@ -3,10 +3,8 @@
PWC Hours
-
{{ countdownTime }}
-
{{ countdownTime }}
-
Time remaining until closure
-
Time remaining until next opening
+
{{ openingStatus }}
+
{{ timeStatus }}
@@ -80,25 +78,11 @@ export default {
&& this.currentTime <= this.currentClosingTime
);
},
- countdownTime() {
- const targetTime = this.isOpen
- ? this.currentClosingTime
- : this.nextOpeningTime;
- const timeDiff = targetTime - this.currentTimeMs;
- if (timeDiff <= 0) {
- return '00:00:00';
- }
- const hours = String(Math.floor(timeDiff / (1000 * 60 * 60))).padStart(
- 2,
- '0',
- );
- const minutes = String(
- Math.floor((timeDiff % (1000 * 60 * 60)) / (1000 * 60)),
- ).padStart(2, '0');
- const seconds = String(
- Math.floor((timeDiff % (1000 * 60)) / 1000),
- ).padStart(2, '0');
- return `${hours}:${minutes}:${seconds}`;
+ openingStatus() {
+ return this.isOpen ? 'Open' : `Opens at ${this.formatTime(this.nextOpeningTime)}`;
+ },
+ timeStatus() {
+ return this.isOpen ? 'Closes' : 'Closed';
},
},
methods: {
@@ -113,6 +97,15 @@ export default {
nextDate.setDate(this.currentTime.getDate() + difference);
return nextDate.toDateString();
},
+ formatTime(timeInMs) {
+ const date = new Date(timeInMs);
+ const hours = date.getHours();
+ const minutes = date.getMinutes();
+ const period = hours >= 12 ? 'pm' : 'am';
+ const formattedHours = hours % 12 || 12;
+ const formattedMinutes = String(minutes).padStart(2, '0');
+ return `${formattedHours}:${formattedMinutes} ${period}`;
+ },
updateCurrentTime() {
this.currentTimeMs = Date.now();
},
@@ -133,7 +126,8 @@ export default {
beforeDestroy() {
clearInterval(this.timer);
},
-};
+};
+