Skip to content

Commit

Permalink
Add get today date front
Browse files Browse the repository at this point in the history
  • Loading branch information
kekefreedog committed Feb 3, 2024
1 parent 9449bc0 commit a55123f
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/Front/Library/Utility/DateTime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,18 @@ export default class DateTime {
return result;
}

/**
*
*/
public static getTodayDate = ():string => {

const today = new Date();
const year = today.getFullYear(); // Gets the full year (e.g., 2024)
const month = (today.getMonth() + 1).toString().padStart(2, '0'); // Month is 0-indexed, add 1 to get 1-12
const day = today.getDate().toString().padStart(2, '0'); // Day of the month

return `${year}-${month}-${day}`;

}

}

0 comments on commit a55123f

Please sign in to comment.