14 lines
559 B
TypeScript
14 lines
559 B
TypeScript
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)
|
||
}
|