Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
andig committed Feb 11, 2025
1 parent 57194df commit 7c24f76
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion now.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (now *Now) EndOfHour() time.Time {
// EndOfDay end of day
func (now *Now) EndOfDay() time.Time {
y, m, d := now.Date()
return time.Date(y, m, d, 23, 59, 59, 0, now.Location()).Add(time.Second) // TODO is this always correct?
return time.Date(y, m, d, 23, 59, 0, 0, now.Location()).Add(time.Minute)
}

// EndOfWeek end of week
Expand Down
6 changes: 3 additions & 3 deletions now_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func TestEndOf(t *testing.T) {
assert(With(n).EndOfDay(), "2013-11-19 00:00:00", "EndOfDay")

dstEndOfDay := time.Date(2017, 10, 29, 1, 0, 0, 0, locationBerlin)
assert(With(dstEndOfDay).EndOfDay(), "2017-10-29 00:00:00", "EndOfDay DST")
assert(With(dstEndOfDay).EndOfDay(), "2017-10-30 00:00:00", "EndOfDay DST")

WeekStartDay = time.Tuesday
assert(With(n).EndOfWeek(), "2013-11-19 00:00:00", "EndOfWeek, FirstDayTuesday")
Expand Down Expand Up @@ -193,10 +193,10 @@ func TestEndOf(t *testing.T) {
assert(With(n).EndOfYear(), "2014-01-01 00:00:00", "EndOfYear")

n1 := time.Date(2013, 02, 18, 17, 51, 49, 123456789, time.UTC)
assert(With(n1).EndOfMonth(), "2013-02-29 00:00:00", "EndOfMonth for 2013/02")
assert(With(n1).EndOfMonth(), "2013-03-01 00:00:00", "EndOfMonth for 2013/02")

n2 := time.Date(1900, 02, 18, 17, 51, 49, 123456789, time.UTC)
assert(With(n2).EndOfMonth(), "1900-02-29 00:00:00", "EndOfMonth")
assert(With(n2).EndOfMonth(), "1900-03-01 00:00:00", "EndOfMonth")
}

func TestMondayAndSunday(t *testing.T) {
Expand Down

0 comments on commit 7c24f76

Please sign in to comment.