chore: Remove momentjs, use date-fns (#1233)

This commit is contained in:
Pranav Raj S 2020-09-14 15:14:26 +05:30 committed by GitHub
parent f3a357d832
commit 1312d07aa2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 41 additions and 45 deletions

View file

@ -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);
};