"use strict"; function formatTime(value) { if (value < 10) { value = '0' + value; } return value.toString(); }; Array.prototype.remove = function (value, key) { var index = -1; if (!key) { index = this.indexOf(value); } else { for (var i = 0; i < this.length; i++) { index = this[i][key] === value[key] ? i : -1; if (index > -1) break; } } if (index > -1) { this.splice(index, 1); } }; function sortName(items) { items = items || []; items.sort((l, r) => l.name.localeCompare(r.name, undefined, { sensitivity: 'base' })); return items; } function deepCopy(item) { return JSON.parse(JSON.stringify(item)); } function getDaysOfMonth() { const days = []; days.push(31); days.push(29); days.push(31); days.push(30); days.push(31); days.push(30); days.push(31); days.push(31); days.push(30); days.push(31); days.push(30); days.push(31); return days; } function labelDate(date, dateType) { if (typeof date === 'string' && date.includes('Date')) { date = new Date(date.match(/\d+/)[0] * 1); } switch (dateType) { case 0: return date.toLocaleString('default', { month: 'long', day: 'numeric', year: 'numeric' }); case 1: return date.toLocaleString('default', { month: 'long', year: 'numeric' }); case 2: return date.toLocaleString('default', { year: 'numeric' }); default: return getDecade(date.getFullYear()).toString() + "'s"; } } function getDecade(year) { let intYear = parseInt(year); return intYear - (intYear % 10); } function scrollTo(idToScroll) { let target = document.getElementById(idToScroll); target.scrollIntoView({ behavior: "smooth", block: "end", inline: "nearest" }); }