ui: add node typings

This commit is contained in:
undefined committed 2021-12-08 23:15:27 +08:00
1 parent fcfc93a40a
commit aadc8cdde1
4 files changed
+17 -4

No files matched your search

+3 -2
View File
@@ -7,8 +7,9 @@ export { size, formatSeconds } from '@hydrooj/utils/lib/utils';
const AU = new AnsiUp();
export function ansiToHtml(str: string) {
return AU.ansi_to_html(str);
export function ansiToHtml(str: string, whiteToBlack = true) {
const res = AU.ansi_to_html(str);
return whiteToBlack ? res.replace(/style="color:rgb\(255,255,255\)"/g, 'style="color:black"') : res;
}
export function datetimeSpan(dt: Date | ObjectID, relative = true, format = 'YYYY-M-D H:mm:ss', tz = 'Asia/Shanghai') {