-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #139 from alleslabs/fix/date
fix: change Date to Dayjs
- Loading branch information
Showing
12 changed files
with
52 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,17 @@ | ||
import type { Dayjs } from "dayjs"; | ||
import dayjs from "dayjs"; | ||
|
||
import type { Option } from "lib/types"; | ||
|
||
export const formatUTC = (timestamp: string | Date) => { | ||
const localDate = | ||
typeof timestamp === "string" ? timestamp.concat("Z") : timestamp; | ||
return dayjs(localDate).utc().format("MMM DD, YYYY, h:mm:ss A [(UTC)]"); | ||
}; | ||
export const parseDate = (date: string) => dayjs(date).utc(true); | ||
|
||
export const dateFromNow = (timestamp: string | Date) => { | ||
const localDate = | ||
typeof timestamp === "string" ? timestamp.concat("Z") : timestamp; | ||
return dayjs(localDate).fromNow(); | ||
}; | ||
export const parseDateOpt = (dateOpt: Option<string>): Option<Dayjs> => | ||
dateOpt ? parseDate(dateOpt) : undefined; | ||
|
||
export const parseDate = (date: string) => new Date(`${date}Z`); | ||
export const parseDateDefault = (dateOpt: Option<string>): Dayjs => | ||
dateOpt ? parseDate(dateOpt) : dayjs(0); | ||
|
||
export const parseDateOpt = (dateOpt: Option<string>): Option<Date> => | ||
dateOpt ? parseDate(dateOpt) : undefined; | ||
export const formatUTC = (date: Dayjs) => | ||
date.format("MMM DD, YYYY, h:mm:ss A [(UTC)]"); | ||
|
||
export const parseDateDefault = (dateOpt: Option<string>): Date => | ||
dateOpt ? parseDate(dateOpt) : new Date(0); | ||
export const dateFromNow = (date: Dayjs) => date.fromNow(); |
4df6cc5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
osmosis-celatone-frontend-staging – ./
osmosis-celatone-frontend-staging-git-develop-alleslabs.vercel.app
celatone-frontend-staging.vercel.app
osmosis-celatone-frontend-staging-alleslabs.vercel.app
osmosis-staging.celat.one
4df6cc5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
terra-celatone-frontend-staging – ./
terra-celatone-frontend-staging-git-develop-alleslabs.vercel.app
terra-celatone-frontend-staging-alleslabs.vercel.app
terra-celatone-frontend-staging.vercel.app
terra-staging.celat.one