sozsoft-platform/ui/src/utils/dateUtils.ts

15 lines
559 B
TypeScript
Raw Normal View History

2026-02-24 20:44:16 +00:00
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)
}