make it work for production too
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import type { ISODate } from './types/date'
|
||||
|
||||
const isDevelopment = () => process.env.NODE_ENV === 'development'
|
||||
|
||||
export const formatDate = (date: Date | string) =>
|
||||
new Date(date).toLocaleString()
|
||||
|
||||
@@ -15,6 +17,5 @@ export const formatLongDate = (date: Date | ISODate) =>
|
||||
|
||||
export const formatDiffInMinutes = (date1: ISODate, date2: ISODate) => {
|
||||
const diffInMs = new Date(date2).getTime() - new Date(date1).getTime()
|
||||
// TODO: diff in minutes not in seconds
|
||||
return Math.max(0, Math.round(diffInMs / 1000))
|
||||
return Math.max(0, Math.round(diffInMs / (1000 * (isDevelopment() ? 1 : 60))))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user