File tree Expand file tree Collapse file tree 2 files changed +3
-4
lines changed Expand file tree Collapse file tree 2 files changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -163,7 +163,7 @@ fn (mut p DateTimeParser) parse() !Time {
163
163
}
164
164
}
165
165
'YY' {
166
- year_ = p.must_be_int (2 ) or {
166
+ year_ = now ().year / 100 * 100 + p.must_be_int (2 ) or {
167
167
return error_invalid_time (0 , 'end of string reached before the full year was specified' )
168
168
}
169
169
}
Original file line number Diff line number Diff line change @@ -209,7 +209,6 @@ fn test_parse_format() {
209
209
assert false
210
210
return
211
211
}
212
-
213
212
assert t.year == 2018 && t.month == 1 && t.day == 27 && t.hour == 12 && t.minute == 48
214
213
&& t.second == 34
215
214
@@ -222,8 +221,8 @@ fn test_parse_format() {
222
221
assert t.year == 2018 && t.month == 11 && t.day == 27 && t.hour == 12 && t.minute == 48
223
222
&& t.second == 20
224
223
225
- s = '2018 -1-2 1:8:2'
226
- t = time.parse_format (s, 'YYYY -M-D H:m:s' ) or {
224
+ s = '18 -1-2 1:8:2'
225
+ t = time.parse_format (s, 'YY -M-D H:m:s' ) or {
227
226
eprintln ('> failing format: ${s} | err: ${err} ' )
228
227
assert false
229
228
return
You can’t perform that action at this time.
0 commit comments