2019-08-14 09:48:44 +00:00
|
|
|
/* eslint no-console: 0 */
|
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: {
|
|
|
|
messageStamp(time) {
|
2020-09-14 09:44:26 +00:00
|
|
|
const unixTime = fromUnixTime(time);
|
|
|
|
return format(unixTime, 'h:mm a');
|
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
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|