Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | 525x 525x 525x 525x 525x 525x 3058x 3058x 12x 12x 4x | export function deepCopy<T>(obj: T): T { if (obj === null || typeof obj !== 'object') { return obj; } if (Array.isArray(obj)) { const arrCopy: T[] = []; for (const item of obj) { arrCopy.push(deepCopy(item)); } return arrCopy as unknown as T; } const objCopy: { [key: string]: T[keyof T] } = {} as { [key: string]: T[keyof T] }; for (const key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { objCopy[key] = deepCopy((obj as { [key: string]: T[keyof T] })[key]); } } return objCopy as T; } export function getWeekNumber(date: Date): number { // Clone the date to avoid modifying the original const current = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate())); // Set the first day of the week to Monday const day = current.getUTCDay() === 0 ? 7 : current.getUTCDay(); // Sunday is 7 // Set the current date to the nearest Thursday (current day + 4 - day number) current.setUTCDate(current.getUTCDate() + 4 - day); // Get the year of the adjusted date const yearStart = new Date(Date.UTC(current.getUTCFullYear(), 0, 1)); // Calculate the week number const weekNumber = Math.ceil((((current.getTime() - yearStart.getTime()) / 86400000) + 1) / 7); return weekNumber; } export function getSeverity(status: string) { Eif(status==="up"){ return "success"; } if(status==="no data"){ return "info"; } return "danger"; } function componentToHex(c:number) { const hex = Math.round(c).toString(16); return hex.length == 1 ? "0" + hex : hex; } export function rgbToHex(r: number, g:number, b:number) { return "#" + componentToHex(r) + componentToHex(g) + componentToHex(b); } |