Skip to content

Commit

Permalink
fix: heure dhiver
Browse files Browse the repository at this point in the history
  • Loading branch information
Arnaud AMBROSELLI committed Nov 2, 2024
1 parent c724ec6 commit dca688a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
4 changes: 2 additions & 2 deletions expo/app.versions.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"buildNumber": 313,
"buildName": "1.26.5"
"buildNumber": 314,
"buildName": "1.26.6"
}
15 changes: 5 additions & 10 deletions expo/src/helpers/dateHelpers.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import dayjs from "dayjs";

export const makeSureDate = (date) => {
if (date instanceof Date) {
return date;
Expand Down Expand Up @@ -26,13 +28,7 @@ export const dateWithoutTime = (inputDate, offset = 0) => {
export const today = (offset = 0, withTime = false) => {
if (withTime) {
const now = new Date();
return new Date(
now.getFullYear(),
now.getMonth(),
now.getDate(),
now.getHours(),
now.getMinutes() + 1
);
return new Date(now.getFullYear(), now.getMonth(), now.getDate(), now.getHours(), now.getMinutes() + 1);
}
return dateWithoutTime(new Date(), offset);
};
Expand All @@ -45,7 +41,6 @@ export const isToday = (inputDate) => {
const msInDays = (timestamp) => timestamp / 1000 / 60 / 60 / 24;

export const differenceOfDays = (date1, date2) => {
date1 = msInDays(Date.parse(dateWithoutTime(makeSureDate(date1))));
date2 = msInDays(Date.parse(dateWithoutTime(makeSureDate(date2))));
return date1 > date2 ? date1 - date2 : date2 - date1;
// Use dayjs to calculate the absolute difference in days
return Math.abs(dayjs(date1).diff(dayjs(date2), "day"));
};

0 comments on commit dca688a

Please sign in to comment.