Skip to content

Commit 57194df

Browse files
committed
wip
1 parent 4518829 commit 57194df

File tree

1 file changed

+39
-39
lines changed

1 file changed

+39
-39
lines changed

now_test.go

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -131,72 +131,72 @@ func TestEndOf(t *testing.T) {
131131

132132
n := time.Date(2013, 11, 18, 17, 51, 49, 123456789, time.UTC)
133133

134-
assert(With(n).EndOfMinute(), "2013-11-18 17:51:59.999999999", "EndOfMinute")
134+
assert(With(n).EndOfMinute(), "2013-11-18 17:52:00", "EndOfMinute")
135135

136-
assert(With(n).EndOfHour(), "2013-11-18 17:59:59.999999999", "EndOfHour")
136+
assert(With(n).EndOfHour(), "2013-11-18 18:00:00", "EndOfHour")
137137

138-
assert(With(timeCaracas).EndOfHour(), "2016-01-01 12:59:59.999999999", "EndOfHour Caracas")
138+
assert(With(timeCaracas).EndOfHour(), "2016-01-01 13:00:00", "EndOfHour Caracas")
139139

140-
assert(With(n).EndOfDay(), "2013-11-19 00:00:00.000000000", "EndOfDay")
140+
assert(With(n).EndOfDay(), "2013-11-19 00:00:00", "EndOfDay")
141141

142142
dstEndOfDay := time.Date(2017, 10, 29, 1, 0, 0, 0, locationBerlin)
143-
assert(With(dstEndOfDay).EndOfDay(), "2017-10-29 00:00:00.000000000", "EndOfDay DST")
143+
assert(With(dstEndOfDay).EndOfDay(), "2017-10-29 00:00:00", "EndOfDay DST")
144144

145145
WeekStartDay = time.Tuesday
146-
assert(With(n).EndOfWeek(), "2013-11-19 00:00:00.000000000", "EndOfWeek, FirstDayTuesday")
146+
assert(With(n).EndOfWeek(), "2013-11-19 00:00:00", "EndOfWeek, FirstDayTuesday")
147147

148148
WeekStartDay = time.Wednesday
149-
assert(With(n).EndOfWeek(), "2013-11-20 00:00:00.000000000", "EndOfWeek, FirstDayWednesday")
149+
assert(With(n).EndOfWeek(), "2013-11-20 00:00:00", "EndOfWeek, FirstDayWednesday")
150150

151151
WeekStartDay = time.Thursday
152-
assert(With(n).EndOfWeek(), "2013-11-21 00:00:00.000000000", "EndOfWeek, FirstDayThursday")
152+
assert(With(n).EndOfWeek(), "2013-11-21 00:00:00", "EndOfWeek, FirstDayThursday")
153153

154154
WeekStartDay = time.Friday
155-
assert(With(n).EndOfWeek(), "2013-11-22 00:00:00.000000000", "EndOfWeek, FirstDayFriday")
155+
assert(With(n).EndOfWeek(), "2013-11-22 00:00:00", "EndOfWeek, FirstDayFriday")
156156

157157
WeekStartDay = time.Saturday
158-
assert(With(n).EndOfWeek(), "2013-11-23 00:00:00.000000000", "EndOfWeek, FirstDaySaturday")
158+
assert(With(n).EndOfWeek(), "2013-11-23 00:00:00", "EndOfWeek, FirstDaySaturday")
159159

160160
WeekStartDay = time.Sunday
161-
assert(With(n).EndOfWeek(), "2013-11-24 00:00:00.000000000", "EndOfWeek, FirstDaySunday")
161+
assert(With(n).EndOfWeek(), "2013-11-24 00:00:00", "EndOfWeek, FirstDaySunday")
162162

163163
WeekStartDay = time.Monday
164-
assert(With(n).EndOfWeek(), "2013-11-25 00:00:00.000000000", "EndOfWeek, FirstDayMonday")
164+
assert(With(n).EndOfWeek(), "2013-11-25 00:00:00", "EndOfWeek, FirstDayMonday")
165165

166166
dstEndOfWeek := time.Date(2017, 10, 24, 12, 0, 0, 0, locationBerlin)
167-
assert(With(dstEndOfWeek).EndOfWeek(), "2017-10-30 00:00:00.000000000", "EndOfWeek, FirstDayMonday")
167+
assert(With(dstEndOfWeek).EndOfWeek(), "2017-10-30 00:00:00", "EndOfWeek, FirstDayMonday")
168168

169169
dstEndOfWeek = time.Date(2017, 10, 29, 12, 0, 0, 0, locationBerlin)
170-
assert(With(dstEndOfWeek).EndOfWeek(), "2017-10-30 00:00:00.000000000", "EndOfWeek, FirstDayMonday")
170+
assert(With(dstEndOfWeek).EndOfWeek(), "2017-10-30 00:00:00", "EndOfWeek, FirstDayMonday")
171171

172172
WeekStartDay = time.Sunday
173-
assert(With(n).EndOfWeek(), "2013-11-24 00:00:00.000000000", "EndOfWeek")
173+
assert(With(n).EndOfWeek(), "2013-11-24 00:00:00", "EndOfWeek")
174174

175175
dstEndOfWeek = time.Date(2017, 10, 29, 0, 0, 0, 0, locationBerlin)
176-
assert(With(dstEndOfWeek).EndOfWeek(), "2017-11-05 00:00:00.000000000", "EndOfWeek")
176+
assert(With(dstEndOfWeek).EndOfWeek(), "2017-11-05 00:00:00", "EndOfWeek")
177177

178178
dstEndOfWeek = time.Date(2017, 10, 29, 12, 0, 0, 0, locationBerlin)
179-
assert(With(dstEndOfWeek).EndOfWeek(), "2017-11-05 00:00:00.000000000", "EndOfWeek")
179+
assert(With(dstEndOfWeek).EndOfWeek(), "2017-11-05 00:00:00", "EndOfWeek")
180180

181-
assert(With(n).EndOfMonth(), "2013-11-31 00:00:00.000000000", "EndOfMonth")
181+
assert(With(n).EndOfMonth(), "2013-11-31 00:00:00", "EndOfMonth")
182182

183-
assert(With(n).EndOfQuarter(), "2014-01-01 00:00:00.000000000", "EndOfQuarter")
183+
assert(With(n).EndOfQuarter(), "2014-01-01 00:00:00", "EndOfQuarter")
184184

185-
assert(With(n).EndOfHalf(), "2014-01-01 00:00:00.000000000", "EndOfHalf")
185+
assert(With(n).EndOfHalf(), "2014-01-01 00:00:00", "EndOfHalf")
186186

187-
assert(With(n.AddDate(0, -1, 0)).EndOfQuarter(), "2014-01-01 00:00:00.000000000", "EndOfQuarter")
187+
assert(With(n.AddDate(0, -1, 0)).EndOfQuarter(), "2014-01-01 00:00:00", "EndOfQuarter")
188188

189-
assert(With(n.AddDate(0, 1, 0)).EndOfQuarter(), "2014-01-01 00:00:00.000000000", "EndOfQuarter")
189+
assert(With(n.AddDate(0, 1, 0)).EndOfQuarter(), "2014-01-01 00:00:00", "EndOfQuarter")
190190

191-
assert(With(n.AddDate(0, 1, 0)).EndOfHalf(), "2014-01-01 00:00:00.000000000", "EndOfHalf")
191+
assert(With(n.AddDate(0, 1, 0)).EndOfHalf(), "2014-01-01 00:00:00", "EndOfHalf")
192192

193-
assert(With(n).EndOfYear(), "2014-01-01 00:00:00.000000000", "EndOfYear")
193+
assert(With(n).EndOfYear(), "2014-01-01 00:00:00", "EndOfYear")
194194

195195
n1 := time.Date(2013, 02, 18, 17, 51, 49, 123456789, time.UTC)
196-
assert(With(n1).EndOfMonth(), "2013-02-29 00:00:00.000000000", "EndOfMonth for 2013/02")
196+
assert(With(n1).EndOfMonth(), "2013-02-29 00:00:00", "EndOfMonth for 2013/02")
197197

198198
n2 := time.Date(1900, 02, 18, 17, 51, 49, 123456789, time.UTC)
199-
assert(With(n2).EndOfMonth(), "1900-02-29 00:00:00.000000000", "EndOfMonth")
199+
assert(With(n2).EndOfMonth(), "1900-02-29 00:00:00", "EndOfMonth")
200200
}
201201

202202
func TestMondayAndSunday(t *testing.T) {
@@ -230,11 +230,11 @@ func TestMondayAndSunday(t *testing.T) {
230230

231231
assert(With(nDst).Sunday(), "2017-10-29 00:00:00", "Sunday DST")
232232

233-
assert(With(n).EndOfSunday(), "2013-11-24 00:00:00.000000000", "EndOfSunday")
233+
assert(With(n).EndOfSunday(), "2013-11-24 00:00:00", "EndOfSunday")
234234

235-
assert(With(timeCaracas).EndOfSunday(), "2016-01-03 00:00:00.000000000", "EndOfSunday Caracas")
235+
assert(With(timeCaracas).EndOfSunday(), "2016-01-03 00:00:00", "EndOfSunday Caracas")
236236

237-
assert(With(nDst).EndOfSunday(), "2017-10-29 00:00:00.000000000", "EndOfSunday DST")
237+
assert(With(nDst).EndOfSunday(), "2017-10-29 00:00:00", "EndOfSunday DST")
238238

239239
assert(With(n).BeginningOfWeek(), "2013-11-17 00:00:00", "BeginningOfWeek, FirstDayMonday")
240240

@@ -427,24 +427,24 @@ func Example() {
427427
BeginningOfQuarter() // 2013-10-01 00:00:00 Tue
428428
BeginningOfYear() // 2013-01-01 00:00:00 Tue
429429

430-
EndOfMinute() // 2013-11-18 17:51:59.999999999 Mon
431-
EndOfHour() // 2013-11-18 17:59:59.999999999 Mon
432-
EndOfDay() // 2013-11-19 00:00:00.000000000 Mon
433-
EndOfWeek() // 2013-11-23 00:00:00.000000000 Sat
430+
EndOfMinute() // 2013-11-18 17:52:00 Mon
431+
EndOfHour() // 2013-11-18 18:00:00 Mon
432+
EndOfDay() // 2013-11-19 00:00:00 Mon
433+
EndOfWeek() // 2013-11-23 00:00:00 Sat
434434

435435
WeekStartDay = time.Monday // Set Monday as first day
436-
EndOfWeek() // 2013-11-24 00:00:00.000000000 Sun
437-
EndOfMonth() // 2013-11-30 00:00:00.000000000 Sat
438-
EndOfQuarter() // 2013-12-31 00:00:00.000000000 Tue
439-
EndOfYear() // 2013-12-31 00:00:00.000000000 Tue
436+
EndOfWeek() // 2013-11-24 00:00:00 Sun
437+
EndOfMonth() // 2013-11-30 00:00:00 Sat
438+
EndOfQuarter() // 2013-12-31 00:00:00 Tue
439+
EndOfYear() // 2013-12-31 00:00:00 Tue
440440

441441
// Use another time
442442
t := time.Date(2013, 02, 18, 17, 51, 49, 123456789, time.UTC)
443-
With(t).EndOfMonth() // 2013-02-28 00:00:00.000000000 Thu
443+
With(t).EndOfMonth() // 2013-02-28 00:00:00 Thu
444444

445445
Monday() // 2013-11-18 00:00:00 Mon
446446
Monday("17:44") // 2013-11-18 17:44:00 Mon
447447
Sunday() // 2013-11-24 00:00:00 Sun
448448
Sunday("17:44") // 2013-11-24 17:44:00 Sun
449-
EndOfSunday() // 2013-11-24 00:00:00.000000000 Sun
449+
EndOfSunday() // 2013-11-24 00:00:00 Sun
450450
}

0 commit comments

Comments
 (0)