.toLocaleString("tr-TR") tarih formatını Türkçe yapıyor ama saat değerini
hâlâ sunucunun sistem saat dilimiyle (Coolify/Hetzner container'ı UTC)
hesaplıyordu. Tüm tarih gösterimleri artık ortak formatTr() helper'ı
üzerinden timeZone: "Europe/Istanbul" ile sabitleniyor.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
11 lines
516 B
TypeScript
11 lines
516 B
TypeScript
/**
|
|
* Server (Coolify/Hetzner) runs in UTC, but the panel is used from Turkey
|
|
* (UTC+3, no DST since 2016) — `.toLocaleString("tr-TR")` alone formats
|
|
* with tr-TR conventions but still uses the *server's* timezone for the
|
|
* actual time value, which was showing everything 3h behind. Always pin
|
|
* the timezone explicitly instead of relying on the runtime's default.
|
|
*/
|
|
export function formatTr(date: Date | string): string {
|
|
return new Date(date).toLocaleString("tr-TR", { timeZone: "Europe/Istanbul" });
|
|
}
|