| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library http_parser; | 5 library http_parser.http_date; |
| 6 | 6 |
| 7 import 'package:string_scanner/string_scanner.dart'; | 7 import 'package:string_scanner/string_scanner.dart'; |
| 8 | 8 |
| 9 const _WEEKDAYS = const ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]; | 9 const _WEEKDAYS = const ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]; |
| 10 const _MONTHS = const ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", | 10 const _MONTHS = const ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", |
| 11 "Sep", "Oct", "Nov", "Dec"]; | 11 "Sep", "Oct", "Nov", "Dec"]; |
| 12 | 12 |
| 13 final _shortWeekdayRegExp = new RegExp(r"Mon|Tue|Wed|Thu|Fri|Sat|Sun"); | 13 final _shortWeekdayRegExp = new RegExp(r"Mon|Tue|Wed|Thu|Fri|Sat|Sun"); |
| 14 final _longWeekdayRegExp = | 14 final _longWeekdayRegExp = |
| 15 new RegExp(r"Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday"); | 15 new RegExp(r"Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday"); |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 DateTime _makeDateTime(int year, int month, int day, DateTime time) { | 143 DateTime _makeDateTime(int year, int month, int day, DateTime time) { |
| 144 var dateTime = new DateTime.utc( | 144 var dateTime = new DateTime.utc( |
| 145 year, month, day, time.hour, time.minute, time.second); | 145 year, month, day, time.hour, time.minute, time.second); |
| 146 | 146 |
| 147 // If [day] was too large, it will cause [month] to overflow. | 147 // If [day] was too large, it will cause [month] to overflow. |
| 148 if (dateTime.month != month) { | 148 if (dateTime.month != month) { |
| 149 throw new FormatException("invalid day '$day' for month '$month'."); | 149 throw new FormatException("invalid day '$day' for month '$month'."); |
| 150 } | 150 } |
| 151 return dateTime; | 151 return dateTime; |
| 152 } | 152 } |
| OLD | NEW |