| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 part of dart.io; | 5 part of dart.io; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Utility functions for working with dates with HTTP specific date | 8 * Utility functions for working with dates with HTTP specific date |
| 9 * formats. | 9 * formats. |
| 10 */ | 10 */ |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 /** | 65 /** |
| 66 * Parse a date string in either of the formats | 66 * Parse a date string in either of the formats |
| 67 * [RFC-1123](http://tools.ietf.org/html/rfc1123 "RFC-1123"), | 67 * [RFC-1123](http://tools.ietf.org/html/rfc1123 "RFC-1123"), |
| 68 * [RFC-850](http://tools.ietf.org/html/rfc850 "RFC-850") or | 68 * [RFC-850](http://tools.ietf.org/html/rfc850 "RFC-850") or |
| 69 * ANSI C's asctime() format. These formats are listed here. | 69 * ANSI C's asctime() format. These formats are listed here. |
| 70 * | 70 * |
| 71 * Thu, 1 Jan 1970 00:00:00 GMT | 71 * Thu, 1 Jan 1970 00:00:00 GMT |
| 72 * Thursday, 1-Jan-1970 00:00:00 GMT | 72 * Thursday, 1-Jan-1970 00:00:00 GMT |
| 73 * Thu Jan 1 00:00:00 1970 | 73 * Thu Jan 1 00:00:00 1970 |
| 74 * | 74 * |
| 75 * For more information see [RFC-2616 section 3.1.1] | 75 * For more information see [RFC-2616 section |
| 76 * (http://tools.ietf.org/html/rfc2616#section-3.3.1 | 76 * 3.1.1](http://tools.ietf.org/html/rfc2616#section-3.3.1 |
| 77 * "RFC-2616 section 3.1.1"). | 77 * "RFC-2616 section 3.1.1"). |
| 78 */ | 78 */ |
| 79 static DateTime parse(String date) { | 79 static DateTime parse(String date) { |
| 80 final int SP = 32; | 80 final int SP = 32; |
| 81 const List wkdays = const ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]; | 81 const List wkdays = const ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]; |
| 82 const List weekdays = const ["Monday", "Tuesday", "Wednesday", "Thursday", | 82 const List weekdays = const ["Monday", "Tuesday", "Wednesday", "Thursday", |
| 83 "Friday", "Saturday", "Sunday"]; | 83 "Friday", "Saturday", "Sunday"]; |
| 84 const List months = const ["Jan", "Feb", "Mar", "Apr", "May", "Jun", | 84 const List months = const ["Jan", "Feb", "Mar", "Apr", "May", "Jun", |
| 85 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; | 85 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; |
| 86 const List wkdaysLowerCase = | 86 const List wkdaysLowerCase = |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 int hour = toInt(timeList[0]); | 306 int hour = toInt(timeList[0]); |
| 307 int minute = toInt(timeList[1]); | 307 int minute = toInt(timeList[1]); |
| 308 int second = toInt(timeList[2]); | 308 int second = toInt(timeList[2]); |
| 309 if (hour > 23) error(); | 309 if (hour > 23) error(); |
| 310 if (minute > 59) error(); | 310 if (minute > 59) error(); |
| 311 if (second > 59) error(); | 311 if (second > 59) error(); |
| 312 | 312 |
| 313 return new DateTime.utc(year, month, dayOfMonth, hour, minute, second, 0); | 313 return new DateTime.utc(year, month, dayOfMonth, hour, minute, second, 0); |
| 314 } | 314 } |
| 315 } | 315 } |
| OLD | NEW |