2020-09-14 09:44:26 +00:00
|
|
|
import fromUnixTime from 'date-fns/fromUnixTime';
|
|
|
|
import format from 'date-fns/format';
|
|
|
|
import formatDistanceToNow from 'date-fns/formatDistanceToNow';
|
2019-08-14 09:48:44 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
methods: {
|
2021-02-11 06:40:08 +00:00
|
|
|
messageStamp(time, dateFormat = 'h:mm a') {
|
2020-09-14 09:44:26 +00:00
|
|
|
const unixTime = fromUnixTime(time);
|
2021-02-11 06:40:08 +00:00
|
|
|
return format(unixTime, dateFormat);
|
2019-08-14 09:48:44 +00:00
|
|
|
},
|
|
|
|
dynamicTime(time) {
|
2020-09-14 09:44:26 +00:00
|
|
|
const unixTime = fromUnixTime(time);
|
|
|
|
return formatDistanceToNow(unixTime, { addSuffix: true });
|
2019-08-14 09:48:44 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|