mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
1import {getLocales} from 'expo-localization' 2 3const LOCALE = getLocales()[0] 4 5// we need the date in the form yyyy-MM-dd to pass to the input 6export function toSimpleDateString(date: Date | string): string { 7 const _date = typeof date === 'string' ? new Date(date) : date 8 return _date.toISOString().split('T')[0] 9} 10 11export function localizeDate(date: Date | string): string { 12 const _date = typeof date === 'string' ? new Date(date) : date 13 return new Intl.DateTimeFormat(LOCALE.languageTag, { 14 timeZone: 'UTC', 15 }).format(_date) 16}