Skip to content

Commit

Permalink
fix: error resolve
Browse files Browse the repository at this point in the history
  • Loading branch information
pepperdad committed Nov 20, 2023
1 parent c2498b7 commit fac9116
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/shared/utils/convert.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
export const stringToDate = (inputDate: string) => {
const dateObject = new Date(inputDate);

const formattedDate = `${String(dateObject.getFullYear()).slice(-2)}.${String(
dateObject.getMonth() + 1,
).padStart(2, "0")}.${String(dateObject.getDate()).padStart(2, "0")}`;

return formattedDate;
};

export const getDaysDifference = (durationStart: string) => {
const startDate = new Date(durationStart);
const currentDate = new Date();

const timeDifference = currentDate.getTime() - startDate.getTime();
const daysDifference = Math.floor(timeDifference / (1000 * 3600 * 24));

return daysDifference;
};
1 change: 1 addition & 0 deletions src/shared/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from "./regex";
export * from "./format";
export * from "./logout";
export * from "./convert";

0 comments on commit fac9116

Please sign in to comment.