Skip to content

Commit 005a7f9

Browse files
committed
refactor: Remove unused properties and functions from Clock component for improved clarity
1 parent 75296f7 commit 005a7f9

1 file changed

Lines changed: 19 additions & 22 deletions

File tree

apps/frontend/src/components/Clock.vue

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,18 @@
1515
</template>
1616

1717
<script>
18-
import { isLocationInJava, getWeton } from "../utils/weton.js";
18+
const dayMap = {
19+
Minggu: "Ahad",
20+
Senin: "Senin",
21+
Selasa: "Selasa",
22+
Rabu: "Rabu",
23+
Kamis: "Kamis",
24+
Jumat: "Jumat",
25+
Sabtu: "Sabtu",
26+
};
1927
2028
export default {
21-
props: ["darkMode", "userTimezone", "lat", "lon"],
29+
props: ["darkMode", "userTimezone"],
2230
data() {
2331
return {
2432
currentTime: "🕒 Memuat Waktu...",
@@ -28,49 +36,38 @@ export default {
2836
},
2937
mounted() {
3038
this.updateRealTime();
31-
this.checkAndSetWeton();
32-
},
33-
watch: {
34-
lat: "checkAndSetWeton",
35-
lon: "checkAndSetWeton",
3639
},
3740
beforeUnmount() {
3841
clearInterval(this.intervalId);
3942
},
4043
methods: {
4144
updateRealTime() {
42-
clearInterval(this.intervalId); // Bersihkan sebelumnya untuk mencegah dobel timer
45+
clearInterval(this.intervalId);
4346
this.intervalId = setInterval(() => {
4447
const now = new Date();
4548
const offset = now.getTimezoneOffset() / -60;
46-
const weton = getWeton(now);
4749
48-
const formattedDate = now.toLocaleString("id-ID", {
49-
weekday: "long",
50+
const day = now.toLocaleDateString("id-ID", { weekday: "long" });
51+
const correctedDay = dayMap[day] || day;
52+
53+
const rest = now.toLocaleDateString("id-ID", {
5054
year: "numeric",
5155
month: "long",
5256
day: "numeric",
57+
});
58+
59+
const time = now.toLocaleTimeString("id-ID", {
5360
hour: "2-digit",
5461
minute: "2-digit",
5562
second: "2-digit",
5663
});
5764
58-
const parts = formattedDate.split(", ");
59-
if (parts.length >= 2) {
60-
parts[0] += ` ${weton}`;
61-
}
62-
63-
this.currentTime = `🕒 ${parts.join(", ")}`;
65+
this.currentTime = `🕒 ${correctedDay}, ${rest}, ${time}`;
6466
this.timezone = `🌍 Zona Waktu: ${this.userTimezone} (UTC${
6567
offset >= 0 ? "+" : ""
6668
}${offset})`;
6769
}, 1000);
6870
},
69-
checkAndSetWeton() {
70-
if (this.lat && this.lon && isLocationInJava(this.lat, this.lon)) {
71-
this.updateRealTime();
72-
}
73-
},
7471
},
7572
};
7673
</script>

0 commit comments

Comments
 (0)