sozsoft-platform/ui/src/utils/dateUtils.ts
Sedat Öztürk 429227df1d Initial
2026-02-24 23:44:16 +03:00

14 lines
559 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import dayjs from 'dayjs'
// Veritabanındaki tarihi olduğu gibi göstermek için yardımcı fonksiyon
export function showDbDateAsIs(dateStr: string) {
if (!dateStr) return ''
// ISO formatı veya '2025-08-27 14:15:00.0000000' gibi formatlar için
// Sadece ilk 19 karakteri (YYYY-MM-DD HH:mm:ss) al
return dateStr.replace('T', ' ').substring(0, 19)
}
// Locale parametresi alan fonksiyon - hook kullanmadan
export function currentLocalDate(date: Date, locale: string, format: string = 'LL') {
return dayjs(date).locale(locale).format(format)
}