mirror of
https://github.com/Lissy93/awesome-privacy.git
synced 2026-03-11 08:55:33 +00:00
Adds a timestamp to date util
This commit is contained in:
parent
3806d4755b
commit
5c0691d8d6
1 changed files with 9 additions and 0 deletions
|
|
@ -6,6 +6,15 @@ export const formatDate = (date: string): string => {
|
|||
});
|
||||
}
|
||||
|
||||
export const timestampToDate = (timestamp: number): string => {
|
||||
return new Date(timestamp).toLocaleDateString('en-GB', {
|
||||
day: '2-digit',
|
||||
month: 'short',
|
||||
year: '2-digit'
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
export const timeAgo = (dateStr: string): string => {
|
||||
const seconds = Math.floor((new Date().getTime() - new Date(dateStr).getTime()) / 1000);
|
||||
const intervals = {
|
||||
|
|
|
|||
Loading…
Reference in a new issue