Clean up deps

This commit is contained in:
Lee Robinson 2024-08-24 23:23:37 -05:00
parent b38c49da59
commit aa857aeb21
7 changed files with 2787 additions and 4425 deletions

View file

@ -87,3 +87,48 @@ export const getMessageFromCode = (resultCode: string) => {
return 'Logged in!'
}
}
export function format(date: Date, formatString: string) {
const year = date.getFullYear()
const month = date.getMonth()
const day = date.getDate()
const hours = String(date.getHours()).padStart(2, '0')
const minutes = String(date.getMinutes()).padStart(2, '0')
const seconds = String(date.getSeconds()).padStart(2, '0')
const monthNames = [
'Jan',
'Feb',
'Mar',
'Apr',
'May',
'Jun',
'Jul',
'Aug',
'Sep',
'Oct',
'Nov',
'Dec'
]
return formatString
.replace('yyyy', year.toString())
.replace('yy', String(year).slice(-2))
.replace('LLL', monthNames[month])
.replace('MM', String(month + 1).padStart(2, '0'))
.replace('dd', String(day).padStart(2, '0'))
.replace('d', day.toString())
.replace('HH', hours)
.replace('mm', minutes)
.replace('ss', seconds)
}
export function parseISO(dateString: string) {
return new Date(dateString)
}
export function subMonths(date: Date, amount: number) {
const newDate: Date = new Date(date)
newDate.setMonth(newDate.getMonth() - amount)
return newDate
}