feat: better article parsing + html dom base
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
export function dateFromParts(
|
||||
year: string | undefined,
|
||||
month: string | undefined,
|
||||
day: string | undefined,
|
||||
): Date {
|
||||
return new Date(parseInt(year ?? ''), parseInt(month ?? '') - 1, parseInt(day ?? ''))
|
||||
}
|
||||
|
||||
export function simpleDateFormat(date: Date): string {
|
||||
return (
|
||||
date.getFullYear() +
|
||||
'-' +
|
||||
(date.getMonth() + 1).toString().padStart(2, '0') +
|
||||
'-' +
|
||||
date.getDate().toString().padStart(2, '0')
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user