This commit is contained in:
2023-10-02 23:10:49 +03:00
commit c6cb488379
255 changed files with 18731 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
import {formatDistanceToNow, parseJSON} from "date-fns";
export function friendlyDate(date) {
return formatDistanceToNow(parseJSON(date), {addSuffix: true});
}
export function stripHtml(html = "") {
let tmp = document.createElement("div");
tmp.innerHTML = html;
return tmp.textContent || tmp.innerText || "";
}
export function randomId(length = 10) {
return Math.random().toString(36).substring(2, length + 2);
}