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

Unified Diff: pkg/http_parser/lib/src/http_date.dart

Issue 278783002: pkg/http_parser: fixed edge cases with 9s and single-digit days (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/http_parser/CHANGELOG.md ('k') | pkg/http_parser/pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/http_parser/lib/src/http_date.dart
diff --git a/pkg/http_parser/lib/src/http_date.dart b/pkg/http_parser/lib/src/http_date.dart
index 47ac547a8fe77df43804e75ad5a0a2af8d9e7f80..ff7c710dc895c2ee081def50a445aea1fc2919e9 100644
--- a/pkg/http_parser/lib/src/http_date.dart
+++ b/pkg/http_parser/lib/src/http_date.dart
@@ -26,16 +26,17 @@ String formatHttpDate(DateTime date) {
var buffer = new StringBuffer()
..write(_WEEKDAYS[date.weekday - 1])
..write(", ")
+ ..write(date.day <= 9 ? "0" : "")
..write(date.day.toString())
..write(" ")
..write(_MONTHS[date.month - 1])
..write(" ")
..write(date.year.toString())
- ..write(date.hour < 9 ? " 0" : " ")
+ ..write(date.hour <= 9 ? " 0" : " ")
..write(date.hour.toString())
- ..write(date.minute < 9 ? ":0" : ":")
+ ..write(date.minute <= 9 ? ":0" : ":")
..write(date.minute.toString())
- ..write(date.second < 9 ? ":0" : ":")
+ ..write(date.second <= 9 ? ":0" : ":")
..write(date.second.toString())
..write(" GMT");
return buffer.toString();
nweiz 2014/05/09 20:24:31 This code came straight from dart:io, so it's prob
kevmoo 2014/05/09 20:33:02 It looks like it's okay here https://github.com/da
nweiz 2014/05/09 20:39:35 That's still missing a leading zero for the day, i
« no previous file with comments | « pkg/http_parser/CHANGELOG.md ('k') | pkg/http_parser/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698