6d71385846
Revert beginningOfDay() to use local timezone methods — the UTC change from #2790 caused cards created earlier the same day to show "yesterday" for users in UTC-negative timezones after their local 7 PM. Add Time.zone.name to day timeline fragment cache keys so timezone-different renders don't collide.
16 lines
512 B
JavaScript
16 lines
512 B
JavaScript
export function differenceInDays(fromDate, toDate) {
|
|
return Math.round(Math.abs((beginningOfDay(toDate) - beginningOfDay(fromDate)) / (1000 * 60 * 60 * 24)))
|
|
}
|
|
|
|
export function signedDifferenceInDays(fromDate, toDate) {
|
|
return Math.round((beginningOfDay(toDate) - beginningOfDay(fromDate)) / (1000 * 60 * 60 * 24))
|
|
}
|
|
|
|
export function beginningOfDay(date) {
|
|
return new Date(date.getFullYear(), date.getMonth(), date.getDate())
|
|
}
|
|
|
|
export function secondsToDate(seconds) {
|
|
return new Date(seconds * 1000)
|
|
}
|