Добавлен штамп времени для любых объектов

This commit is contained in:
Pavel Gnedov 2022-07-18 14:43:20 +07:00
parent 26ed9b92f9
commit 326b97931c
2 changed files with 11 additions and 0 deletions

View file

@ -0,0 +1,3 @@
export type Timestamped = {
_timestamp: number;
};

View file

@ -0,0 +1,8 @@
import { Timestamped } from '../models/timestamped';
export function TimestampNowFill<T>(obj: T): T & Timestamped {
const now = new Date().getDate();
const res: any = obj;
res._timestamp = now;
return res;
}