summaryrefslogtreecommitdiffstats
path: root/common/htime/time.go
diff options
context:
space:
mode:
Diffstat (limited to 'common/htime/time.go')
-rw-r--r--common/htime/time.go11
1 files changed, 7 insertions, 4 deletions
diff --git a/common/htime/time.go b/common/htime/time.go
index f2fff897c..c71e39ee4 100644
--- a/common/htime/time.go
+++ b/common/htime/time.go
@@ -124,12 +124,15 @@ func (f TimeFormatter) Format(t time.Time, layout string) string {
monthIdx := t.Month() - 1 // Month() starts at 1.
dayIdx := t.Weekday()
- s = strings.ReplaceAll(s, longMonthNames[monthIdx], f.ltr.MonthWide(t.Month()))
- if !strings.Contains(s, f.ltr.MonthWide(t.Month())) {
+ if strings.Contains(layout, "January") {
+ s = strings.ReplaceAll(s, longMonthNames[monthIdx], f.ltr.MonthWide(t.Month()))
+ } else if strings.Contains(layout, "Jan") {
s = strings.ReplaceAll(s, shortMonthNames[monthIdx], f.ltr.MonthAbbreviated(t.Month()))
}
- s = strings.ReplaceAll(s, longDayNames[dayIdx], f.ltr.WeekdayWide(t.Weekday()))
- if !strings.Contains(s, f.ltr.WeekdayWide(t.Weekday())) {
+
+ if strings.Contains(layout, "Monday") {
+ s = strings.ReplaceAll(s, longDayNames[dayIdx], f.ltr.WeekdayWide(t.Weekday()))
+ } else if strings.Contains(layout, "Mon") {
s = strings.ReplaceAll(s, shortDayNames[dayIdx], f.ltr.WeekdayAbbreviated(t.Weekday()))
}