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