Skip to content
This repository has been archived by the owner on Aug 26, 2022. It is now read-only.

Commit

Permalink
Merge pull request #317 from capsule-corp-ternoa/staging
Browse files Browse the repository at this point in the history
Staging
  • Loading branch information
Leouarz authored Jan 10, 2022
2 parents 807d9cc + 287babf commit 6a81d05
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions utils/strings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,14 @@ export const removeURLSlash = (url: string) => {
}

export const formatDate = (d: Date) => {
//06/08/2021, 13:21
return `${d.getDate()}/${d.getMonth()}/${d.getFullYear()}, ${d.getHours()}:${d.getMinutes()}`
//eg 06/08/2021, 13:21
const day = d.getDate()
const month = d.getMonth() + 1
const year = d.getFullYear()
const hours = d.getHours()
const minutes = d.getMinutes()
const formatVal = (val: number) => val < 10 ? `0${val}` : val
return `${formatVal(day)}/${formatVal(month)}/${formatVal(year)}, ${formatVal(hours)}:${formatVal(minutes)}`
}

export const formatPrice = (n: number) => {
Expand Down

1 comment on commit 6a81d05

@vercel
Copy link

@vercel vercel bot commented on 6a81d05 Jan 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.