Fix landing 500 from invalid Asia/Esfahan timezone.
Normalize Iran city aliases to Asia/Tehran, harden the clock, and make settings timezone a safe select. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -18,20 +18,19 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { formatClock } from "~/utils/timezone";
|
||||
|
||||
const props = defineProps<{ brand?: string; timezone?: string }>();
|
||||
const brand = computed(() => props.brand || "منتک");
|
||||
const time = ref("");
|
||||
|
||||
onMounted(() => {
|
||||
const tz = props.timezone || "Asia/Tehran";
|
||||
const tick = () => {
|
||||
time.value = new Intl.DateTimeFormat("fa-IR", {
|
||||
timeZone: tz,
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
second: "2-digit",
|
||||
hour12: false,
|
||||
}).format(new Date());
|
||||
try {
|
||||
time.value = formatClock(new Date(), props.timezone);
|
||||
} catch {
|
||||
time.value = "";
|
||||
}
|
||||
};
|
||||
tick();
|
||||
const id = setInterval(tick, 1000);
|
||||
|
||||
Reference in New Issue
Block a user