Skip to content

Commit 6af3e33

Browse files
committed
fixup! add DST and week calculation tests
1 parent eb46ae2 commit 6af3e33

File tree

2 files changed

+1
-12
lines changed

2 files changed

+1
-12
lines changed

coderd/schedule/autostop.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -214,17 +214,6 @@ func nextDayMidnight(t time.Time) time.Time {
214214
return time.Date(yy, mm, dd, 0, 0, 0, 0, t.Location())
215215
}
216216

217-
// truncateMondayMidnight truncates a time to the previous Monday at midnight in
218-
// the time object's timezone.
219-
func truncateMondayMidnight(t time.Time) time.Time {
220-
// time.Date will correctly normalize the date if it's past the end of the
221-
// month. E.g. October 32nd will be November 1st.
222-
yy, mm, dd := t.Date()
223-
dd -= int(t.Weekday() - 1)
224-
t = time.Date(yy, mm, dd, 0, 0, 0, 0, t.Location())
225-
return truncateMidnight(t)
226-
}
227-
228217
// WeeksSinceEpoch gets the weeks since the epoch for a given time. This is a
229218
// 0-indexed number of weeks since the epoch (Monday).
230219
//

enterprise/cli/licenses.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ import (
1010
"strings"
1111
"time"
1212

13+
"github.com/google/uuid"
1314
"golang.org/x/xerrors"
1415

1516
"github.com/coder/coder/cli/clibase"
1617
"github.com/coder/coder/cli/cliui"
1718
"github.com/coder/coder/codersdk"
18-
"github.com/google/uuid"
1919
)
2020

2121
var jwtRegexp = regexp.MustCompile(`^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$`)

0 commit comments

Comments
 (0)