Skip to content

Commit

Permalink
Switch argument order
Browse files Browse the repository at this point in the history
  • Loading branch information
mholt committed Aug 4, 2024
1 parent ddeec2c commit c607125
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion types.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ func ParseDate(ddmmyy string) (Date, error) {
// For example, if the referenceYear is 2024, the offset used is 2000; and the input date's year is prepended with 20.
// If referenceYear is 0, the current UTC year is used.
// If either Date or Time is not valid, DateTime returns the zero time.Time.
func DateTime(referenceYear int, d Date, t Time) time.Time {
func DateTime(d Date, t Time, referenceYear int) time.Time {
if !d.Valid || !t.Valid {
return time.Time{}
}
Expand Down
4 changes: 2 additions & 2 deletions types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,9 @@ func TestDateTime(t *testing.T) {
expect: time.Time{},
},
} {
actual := DateTime(testCase.refYear, testCase.date, testCase.time)
actual := DateTime(testCase.date, testCase.time, testCase.refYear)
if !actual.Equal(testCase.expect) {
t.Fatalf("Test %d (refYear=%d date=%s time=%s): Expected %s but got %s", i, testCase.refYear, testCase.date, testCase.time, testCase.expect, actual)
t.Fatalf("Test %d (date=%s time=%s refYear=%d ): Expected %s but got %s", i, testCase.date, testCase.time, testCase.refYear, testCase.expect, actual)
}
}
}
Expand Down

0 comments on commit c607125

Please sign in to comment.