From 6507d02d4e944be08c3c88fc82024f8329536172 Mon Sep 17 00:00:00 2001 From: Arnaud AMBROSELLI Date: Mon, 11 Nov 2024 12:31:31 +0100 Subject: [PATCH] better fix of abstinence --- expo/app.versions.json | 4 ++-- expo/package.json | 2 +- expo/src/helpers/dateHelpers.js | 10 +++++----- expo/src/scenes/Infos/Transfer.js | 6 ++---- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/expo/app.versions.json b/expo/app.versions.json index 045978341..5e5dc0c13 100644 --- a/expo/app.versions.json +++ b/expo/app.versions.json @@ -1,4 +1,4 @@ { - "buildNumber": 315, - "buildName": "1.26.6" + "buildNumber": 316, + "buildName": "1.26.7" } diff --git a/expo/package.json b/expo/package.json index 7e60a6e3c..ff5067930 100644 --- a/expo/package.json +++ b/expo/package.json @@ -1,6 +1,6 @@ { "name": "oz-ensemble", - "version": "1.26.6", + "version": "1.26.7", "scripts": { "get-ip": "./get-ip.sh && echo \"this script updates the API IP to your own IP, because that's what Android Emulator needs to work. It's based on your wifi IP, if you need ethernet it won't work (needs en1 instead of en0)\"", "start": "expo start --dev-client", diff --git a/expo/src/helpers/dateHelpers.js b/expo/src/helpers/dateHelpers.js index 6451d7f80..caa1d3d23 100644 --- a/expo/src/helpers/dateHelpers.js +++ b/expo/src/helpers/dateHelpers.js @@ -38,9 +38,9 @@ export const isToday = (inputDate) => { return Date.parse(date) === Date.parse(today()); }; -const msInDays = (timestamp) => timestamp / 1000 / 60 / 60 / 24; - export const differenceOfDays = (date1, date2) => { - // Use dayjs to calculate the absolute difference in days - return Math.abs(dayjs(date1).diff(dayjs(date2), "day")); -}; + // Convert dates to start of day in local timezone to avoid DST issues + const d1 = dayjs(date1).startOf('day'); + const d2 = dayjs(date2).startOf('day'); + return Math.abs(d1.diff(d2, 'day')); +}; \ No newline at end of file diff --git a/expo/src/scenes/Infos/Transfer.js b/expo/src/scenes/Infos/Transfer.js index 5adf14f3f..58a91c841 100644 --- a/expo/src/scenes/Infos/Transfer.js +++ b/expo/src/scenes/Infos/Transfer.js @@ -60,14 +60,12 @@ const Transfer = ({ navigation }) => { }; try { - await Share.open(shareOptions).then(() => { - (res) => { + await Share.open(shareOptions).then((res) => { console.log(res); logEvent({ category: "TRANSFER", action: "EXPORT_DATA_SUCCESS" }); Alert.alert("Vos données ont bien été sauvegardées."); storage.set("@ExportedData", true); - }; - }); + }); } catch (error) { console.log("Error sharing:", error); Alert.alert("Erreur lors du partage des données.");