yoake/webroot/lib/lib.js

20 lines
523 B
JavaScript
Raw Normal View History

2022-11-11 16:15:22 -06:00
function doNow(fn) {
fn();
return fn;
2022-11-16 14:54:46 -06:00
}
2022-11-18 23:37:47 -06:00
function labelTimeElement(tag, time, format) {
2022-11-16 14:54:46 -06:00
time = dayjs(time);
2022-11-18 23:37:47 -06:00
if (tag.innerText == "" || format)
tag.innerText = format ? time.format(format) : time.fromNow();
2022-11-16 14:54:46 -06:00
tag.setAttribute("data-bs-toggle", "tooltip");
tag.setAttribute("data-bs-title", time.format("L LT"));
new bootstrap.Tooltip(tag);
2022-11-16 20:09:07 -06:00
}
function dateInZone(zone) {
if (zone)
return new Date(new Date().toLocaleString("en-US", { timeZone: zone }));
return new Date()
2022-11-11 16:15:22 -06:00
}