chore: Remove momentjs
, use date-fns
(#1233)
This commit is contained in:
parent
f3a357d832
commit
1312d07aa2
8 changed files with 41 additions and 45 deletions
|
@ -1,13 +1,7 @@
|
|||
import moment from 'moment';
|
||||
import fromUnixTime from 'date-fns/fromUnixTime';
|
||||
import format from 'date-fns/format';
|
||||
|
||||
class DateHelper {
|
||||
constructor(date) {
|
||||
this.date = moment(date * 1000);
|
||||
}
|
||||
|
||||
format(dateFormat = 'MMM DD, YYYY') {
|
||||
return this.date.format(dateFormat);
|
||||
}
|
||||
}
|
||||
|
||||
export default DateHelper;
|
||||
export const formatUnixDate = (date, dateFormat = 'MMM dd, yyyy') => {
|
||||
const unixDate = fromUnixTime(date);
|
||||
return format(unixDate, dateFormat);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue