Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: sdk/lib/io/http_date.dart

Issue 219503002: Fix bad HttpDate.format. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/corelib/date_time_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 DateTime d = date.toUtc(); 45 DateTime d = date.toUtc();
46 StringBuffer sb = new StringBuffer() 46 StringBuffer sb = new StringBuffer()
47 ..write(wkday[d.weekday - 1]) 47 ..write(wkday[d.weekday - 1])
48 ..write(", ") 48 ..write(", ")
49 ..write(d.day.toString()) 49 ..write(d.day.toString())
50 ..write(" ") 50 ..write(" ")
51 ..write(month[d.month - 1]) 51 ..write(month[d.month - 1])
52 ..write(" ") 52 ..write(" ")
53 ..write(d.year.toString()) 53 ..write(d.year.toString())
54 ..write(d.hour < 9 ? " 0" : " ") 54 ..write(d.hour <= 9 ? " 0" : " ")
55 ..write(d.hour.toString()) 55 ..write(d.hour.toString())
56 ..write(d.minute < 9 ? ":0" : ":") 56 ..write(d.minute <= 9 ? ":0" : ":")
57 ..write(d.minute.toString()) 57 ..write(d.minute.toString())
58 ..write(d.second < 9 ? ":0" : ":") 58 ..write(d.second <= 9 ? ":0" : ":")
59 ..write(d.second.toString()) 59 ..write(d.second.toString())
60 ..write(" GMT"); 60 ..write(" GMT");
61 return sb.toString(); 61 return sb.toString();
62 } 62 }
63 63
64 /** 64 /**
65 * Parse a date string in either of the formats 65 * Parse a date string in either of the formats
66 * [RFC-1123](http://tools.ietf.org/html/rfc1123 "RFC-1123"), 66 * [RFC-1123](http://tools.ietf.org/html/rfc1123 "RFC-1123"),
67 * [RFC-850](http://tools.ietf.org/html/rfc850 "RFC-850") or 67 * [RFC-850](http://tools.ietf.org/html/rfc850 "RFC-850") or
68 * ANSI C's asctime() format. These formats are listed here. 68 * ANSI C's asctime() format. These formats are listed here.
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 int hour = toInt(timeList[0]); 305 int hour = toInt(timeList[0]);
306 int minute = toInt(timeList[1]); 306 int minute = toInt(timeList[1]);
307 int second = toInt(timeList[2]); 307 int second = toInt(timeList[2]);
308 if (hour > 23) error(); 308 if (hour > 23) error();
309 if (minute > 59) error(); 309 if (minute > 59) error();
310 if (second > 59) error(); 310 if (second > 59) error();
311 311
312 return new DateTime.utc(year, month, dayOfMonth, hour, minute, second, 0); 312 return new DateTime.utc(year, month, dayOfMonth, hour, minute, second, 0);
313 } 313 }
314 } 314 }
OLDNEW
« no previous file with comments | « no previous file | tests/corelib/date_time_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698