Skip to content

Commit

Permalink
fix(lint): Correction on lint
Browse files Browse the repository at this point in the history
Sur téléphone donc un peu laborieux 😅
  • Loading branch information
samymih authored Mar 1, 2025
1 parent 8d2d863 commit c286472
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/utils/format/DateHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ export const timestampToString = (timestamp: number) => {

const date = new Date(timestamp);
const today = new Date();

if (isNaN(date.getTime())) {
if (Number.isNaN(date.getTime())) {
return "Date invalide";
}

Expand All @@ -23,21 +22,18 @@ export const timestampToString = (timestamp: number) => {
];

let yearDifference = dateDifference[0];

if (dateDifference[1] < 0 || (dateDifference[1] === 0 && dateDifference[2] < 0)) {
yearDifference--;
} else if (dateDifference[1] > 0 || (dateDifference[1] === 0 && dateDifference[2] > 0)) {
yearDifference++;
}

let monthDifference = dateDifference[0] * 12 + dateDifference[1];

if (dateDifference[2] < 0) {
monthDifference--;
} else if (dateDifference[2] > 0) {
monthDifference++;
}

let dayDifference = Math.round(
(date.getTime() - today.getTime()) / (1000 * 60 * 60 * 24)
);
Expand Down

0 comments on commit c286472

Please sign in to comment.