debugging of tsc errors
This commit is contained in:
@@ -21,12 +21,12 @@ export const qs = (
|
|||||||
selector: string | keyof HTMLElementTagNameMap,
|
selector: string | keyof HTMLElementTagNameMap,
|
||||||
parent = document
|
parent = document
|
||||||
): Element => {
|
): Element => {
|
||||||
return parent.querySelector(selector)
|
return parent.querySelector(selector) as unknown as Element
|
||||||
}
|
}
|
||||||
|
|
||||||
export const qsa = (
|
export const qsa = (
|
||||||
selector: string | keyof HTMLElementTagNameMap,
|
selector: string | keyof HTMLElementTagNameMap,
|
||||||
parent = document
|
parent = document
|
||||||
): Element[] => {
|
): NodeListOf<Element> => {
|
||||||
return [...parent.querySelectorAll(selector)]
|
return parent.querySelectorAll(selector)
|
||||||
}
|
}
|
||||||
|
@@ -69,12 +69,19 @@ export const formatRelativeDate = (
|
|||||||
numeric: 'auto'
|
numeric: 'auto'
|
||||||
})
|
})
|
||||||
let duration = (toDate - fromDate) / 1000
|
let duration = (toDate - fromDate) / 1000
|
||||||
|
let output = ''
|
||||||
|
|
||||||
for (let i = 0; i <= DIVISIONS.length; i++) {
|
for (let i = 0; i <= DIVISIONS.length; i++) {
|
||||||
const division = DIVISIONS[i]
|
const division = DIVISIONS[i]
|
||||||
if (Math.abs(duration) < division.amount)
|
if (Math.abs(duration) < division.amount) {
|
||||||
return RELATIVE_DATE_FORMATTER.format(Math.round(duration), division.name)
|
output = RELATIVE_DATE_FORMATTER.format(
|
||||||
|
Math.round(duration),
|
||||||
|
division.name
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
duration /= division.amount
|
duration /= division.amount
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return output
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user