diff --git a/src/App.vue b/src/App.vue
index c4e2267..4d1a9a9 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -91,7 +91,7 @@ export default defineComponent({
this.eorzeaTime = new EorzeaTime();
setInterval(() => {
this.eorzeaTime = new EorzeaTime();
- }, 500);
+ }, 1000);
const itemData: Response | null = await fetch("/data/items.json")
.catch((): null => {
diff --git a/src/components/GatheringNode.vue b/src/components/GatheringNode.vue
index ec0b150..8ccc4e0 100644
--- a/src/components/GatheringNode.vue
+++ b/src/components/GatheringNode.vue
@@ -8,7 +8,7 @@
>
{{
- prettyTimer(gatheringNode.getSecondsToNextActiveTime(eorzeaTime))
+ prettyTimer(secondsToNextActiveTime)
}}
@@ -19,7 +19,7 @@
Active
{{
- prettyTimer(gatheringNode.getSecondsToNextInactiveTime(eorzeaTime))
+ prettyTimer(secondsToNextInactiveTime)
}}
@@ -69,6 +69,12 @@ import Zone from "@/entities/Zone";
export default defineComponent({
name: "GatheringNode",
+ data() {
+ return {
+ secondsToNextInactiveTime: 0 as number,
+ secondsToNextActiveTime: 0 as number,
+ };
+ },
props: {
gatheringNode: {
type: Object as PropType,
@@ -83,13 +89,27 @@ export default defineComponent({
required: true
},
},
+ watch: {
+ eorzeaTime: {
+ handler() {
+ this.calculateTimers()
+ }
+ }
+ },
methods: {
prettyTimer(seconds: number): string {
const minutes = Math.floor(seconds / 60);
const remainingSeconds = seconds % 60;
return `${minutes}:${remainingSeconds < 10 ? '0' : ''}${remainingSeconds}`;
+ },
+ calculateTimers() {
+ this.secondsToNextInactiveTime = this.gatheringNode.getSecondsToNextInactiveTime(this.eorzeaTime);
+ this.secondsToNextActiveTime = this.gatheringNode.getSecondsToNextActiveTime(this.eorzeaTime);
}
},
+ mounted() {
+ this.calculateTimers();
+ }
});
diff --git a/src/components/SortedNodeList.vue b/src/components/SortedNodeList.vue
index 17a3dc7..672bf9c 100644
--- a/src/components/SortedNodeList.vue
+++ b/src/components/SortedNodeList.vue
@@ -49,9 +49,7 @@ export default defineComponent(
}
},
eorzeaTime: {
- handler(newValue, oldValue) {
- if (oldValue === undefined) return;
- if (newValue?.getMinutes() === oldValue?.getMinutes()) return;
+ handler() {
this.sortListByTime();
}
}
diff --git a/src/entities/TimeRange.ts b/src/entities/TimeRange.ts
index f21cdfe..5a0efe4 100644
--- a/src/entities/TimeRange.ts
+++ b/src/entities/TimeRange.ts
@@ -13,7 +13,7 @@ export default class TimeRange {
public isWithinTimeFrame(hour: number, minute: number): boolean {
return (
this.from[0] < hour || this.from[0] == hour && this.from[1] <= minute)
- && (hour < this.to[0] || hour == this.to[0] && minute <= this.to[1]
+ && (hour < this.to[0] || hour == this.to[0] && minute < this.to[1]
);
}