1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 12:56:41 +07:00

added date

This commit is contained in:
Fedor Katurov 2019-10-12 18:35:02 +07:00
parent 2d65641693
commit 2673722af7
7 changed files with 26 additions and 15 deletions

View file

@ -1,4 +1,6 @@
import { IFile } from '~/redux/types';
import formatDistanceToNow from 'date-fns/formatDistanceToNow';
import { ru } from 'date-fns/locale';
export const getStyle = (oElm: any, strCssRule: string) => {
if (document.defaultView && document.defaultView.getComputedStyle) {
@ -75,3 +77,6 @@ export const formatCommentText = (author, text: string) =>
index === 0 ? `${author ? `<p><b>${author}</b>: ` : ''}${el}</p>` : `<p>${el}</p>`
)
.join('');
export const getPrettyDate = (date: string): string =>
formatDistanceToNow(new Date(date), { locale: ru, includeSeconds: true, addSuffix: true });