Generated documentation :)

This commit is contained in:
Calum Bird
2021-11-09 21:24:31 -08:00
parent 5df34cd137
commit f55350bebc
11 changed files with 234 additions and 1 deletions

View File

@@ -7,6 +7,12 @@ import { localeDirection, currentLocale } from "./i18n";
dayjs.extend(utc);
dayjs.extend(timezone);
/**
* Returns the offset from UTC in hours for the current locale.
* @returns {number} The offset from UTC in hours.
*
* Generated by Trelent
*/
function getTimezoneOffset(timeZone) {
const now = new Date();
const tzString = now.toLocaleString("en-US", {
@@ -18,7 +24,14 @@ function getTimezoneOffset(timeZone) {
return -offset;
}
export function timezoneList() {
export /**
* Returns a list of timezones sorted by their offset from UTC.
* @param {Array} timezones - An array of timezone objects.
* @returns {Array} A list of the given timezones sorted by their offset from UTC.
*
* Generated by Trelent
*/
function timezoneList() {
let result = [];
for (let timezone of timezones) {