fix: expiration logging & display
This commit is contained in:
parent
6a4754b1ea
commit
b455c3dfee
@ -225,6 +225,7 @@ func parseTitleExpiration(title *string) (*time.Time, error) {
|
|||||||
|
|
||||||
// Set midnight at the end of the specified day (+0000 UTC)
|
// Set midnight at the end of the specified day (+0000 UTC)
|
||||||
expiresAt = time.Date(expiresAt.Year(), expiresAt.Month(), expiresAt.Day(), 23, 59, 59, 0, time.UTC)
|
expiresAt = time.Date(expiresAt.Year(), expiresAt.Month(), expiresAt.Day(), 23, 59, 59, 0, time.UTC)
|
||||||
|
log.Debug().Msgf("Parsed absolute expiration date '%s' from input '%s'", expiresAt, dateStr)
|
||||||
|
|
||||||
return &expiresAt, nil
|
return &expiresAt, nil
|
||||||
}
|
}
|
||||||
@ -261,6 +262,7 @@ func parseTitleExpiration(title *string) (*time.Time, error) {
|
|||||||
|
|
||||||
// Set midnight at the end of the specified day (+0000 UTC)
|
// Set midnight at the end of the specified day (+0000 UTC)
|
||||||
expiresAt = time.Date(expiresAt.Year(), expiresAt.Month(), expiresAt.Day(), 23, 59, 59, 0, time.UTC)
|
expiresAt = time.Date(expiresAt.Year(), expiresAt.Month(), expiresAt.Day(), 23, 59, 59, 0, time.UTC)
|
||||||
|
log.Debug().Msgf("Parsed relative expiration date '%s' from input '%s%s'", expiresAt, amount, unit)
|
||||||
|
|
||||||
return &expiresAt, nil
|
return &expiresAt, nil
|
||||||
}
|
}
|
||||||
|
@ -17,17 +17,17 @@ export const formatDateLong = (dateString: string | Date): string => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export const formatDateShort = (dateString: string | Date): string => {
|
export const formatDateShort = (input: string | Date): string => {
|
||||||
if (!dateString) {
|
console.log(input)
|
||||||
|
|
||||||
|
if (!input) {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
const d = new Date(dateString)
|
const d = input instanceof Date ? input : new Date(input)
|
||||||
return d.toLocaleDateString(undefined, {
|
const utcDate = new Date(d.getTime())
|
||||||
weekday: "short",
|
|
||||||
year: "2-digit",
|
return `${utcDate.toLocaleString("en", { weekday: "short", day: "numeric", month: "short", year: "2-digit", timeZone: "UTC" })} UTC`
|
||||||
month: "short"
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const parseExpirationPrefix = (title: string): [string, string] => {
|
export const parseExpirationPrefix = (title: string): [string, string] => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user