Skip to content

Commit 3cc2a71

Browse files
committed
fix test
1 parent 873c6c5 commit 3cc2a71

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Diff for: modules/templates/util_date.go

+2
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ func timeSinceLegacy(time any, _ ...any) template.HTML {
7272

7373
func anyToTime(any any) (t time.Time, isZero bool) {
7474
switch v := any.(type) {
75+
case nil:
76+
// it is zero
7577
case time.Time:
7678
t = v
7779
case timeutil.TimeStamp:

Diff for: modules/templates/util_date_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ func TestDateTime(t *testing.T) {
1919
defer test.MockVariableValue(&setting.DefaultUILocation, testTz)()
2020
defer test.MockVariableValue(&setting.IsInTesting, false)()
2121

22-
du := NewDateUtils(nil)
22+
du := NewDateUtils()
2323

2424
refTimeStr := "2018-01-01T00:00:00Z"
2525
refDateStr := "2018-01-01"

0 commit comments

Comments
 (0)