dateFormat fix

This commit is contained in:
tmshv committed 2020-03-03 04:00:59 +03:00
1 parent 0b230a26b4
commit 9fb6eaab66
1 file changed
+2 -1
+2 -1
View File
@@ -8,7 +8,8 @@ import { ru } from 'date-fns/locale'
* @param date
*/
export const dateFormat = (date: string | Date) => {
return format(new Date(2014, 6, 2), "d MMMM yyyy", {
const value = typeof date === 'string' ? new Date(date) : date
return format(value, "d MMMM yyyy", {
locale: ru
})
}