Skip to content

Commit 761f0ee

Browse files
committed
feat: update humanDate to accept custom format
1 parent c85deea commit 761f0ee

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/composables/filters/humanDate.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as dayjs from 'dayjs'
22

3-
export default (dateStr, hideTime) => {
3+
export default (dateStr, hideTime, customFormat) => {
44
//let timezone = PreferencesSvc.preferences.timezone_offset || ''
55
let timezone
66
let result
@@ -15,6 +15,7 @@ export default (dateStr, hideTime) => {
1515
else if (isMaxDate) { result = 'Permanent' } // bans
1616
else { result = dayjs(dateStr).format('MMM D, YYYY') }
1717
}
18+
else if (customFormat) result = dayjs(dateStr).format(customFormat)
1819
else {
1920
if (timezone) {
2021
if (isToday) { result = 'Today at ' + dayjs(dateStr).format('h:mm A').tz(timezone) }

0 commit comments

Comments
 (0)