yoake/webroot/lib/lib.js

20 lines
474 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
}
function labelTimeElement(tag, time) {
time = dayjs(time);
if (tag.innerText == "")
tag.innerText = time.fromNow();
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
}