@@ -131,72 +131,72 @@ func TestEndOf(t *testing.T) {
131
131
132
132
n := time .Date (2013 , 11 , 18 , 17 , 51 , 49 , 123456789 , time .UTC )
133
133
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" )
135
135
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" )
137
137
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" )
139
139
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" )
141
141
142
142
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" )
144
144
145
145
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" )
147
147
148
148
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" )
150
150
151
151
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" )
153
153
154
154
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" )
156
156
157
157
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" )
159
159
160
160
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" )
162
162
163
163
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" )
165
165
166
166
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" )
168
168
169
169
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" )
171
171
172
172
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" )
174
174
175
175
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" )
177
177
178
178
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" )
180
180
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" )
182
182
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" )
184
184
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" )
186
186
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" )
188
188
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" )
190
190
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" )
192
192
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" )
194
194
195
195
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" )
197
197
198
198
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" )
200
200
}
201
201
202
202
func TestMondayAndSunday (t * testing.T ) {
@@ -230,11 +230,11 @@ func TestMondayAndSunday(t *testing.T) {
230
230
231
231
assert (With (nDst ).Sunday (), "2017-10-29 00:00:00" , "Sunday DST" )
232
232
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" )
234
234
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" )
236
236
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" )
238
238
239
239
assert (With (n ).BeginningOfWeek (), "2013-11-17 00:00:00" , "BeginningOfWeek, FirstDayMonday" )
240
240
@@ -427,24 +427,24 @@ func Example() {
427
427
BeginningOfQuarter () // 2013-10-01 00:00:00 Tue
428
428
BeginningOfYear () // 2013-01-01 00:00:00 Tue
429
429
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
434
434
435
435
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
440
440
441
441
// Use another time
442
442
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
444
444
445
445
Monday () // 2013-11-18 00:00:00 Mon
446
446
Monday ("17:44" ) // 2013-11-18 17:44:00 Mon
447
447
Sunday () // 2013-11-24 00:00:00 Sun
448
448
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
450
450
}
0 commit comments