Skip to content

Commit

Permalink
feat: time jsdocs (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tolfx committed Oct 11, 2022
1 parent a64cf18 commit 4c45d56
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/lib/src/Time.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,32 @@
import dateFormat from "date-and-time";


/**
*
* @param date
* @param format
* @returns A string formatted date based on format
*/
export function formatDate(date: Date, format: string): string
{
return dateFormat.format(date, format);
}

/**
* @returns Date format YYYY-MM-DD HH:mm:ss
*/
export function getTime()
{
const D_CurrentDate = new Date();

return dateFormat.format(D_CurrentDate, "YYYY-MM-DD HH:mm:ss");
}

/**
*
* @param removeDays Removes days from current date
* @returns Returns date format YYYY-MM-DD or YYYY-MM
*/
export function getDate(removeDays = false)
{
const D_CurrentDate = new Date();
Expand Down

0 comments on commit 4c45d56

Please sign in to comment.