| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 if (month_day < kMaximumDayInMaximumMonth) | 176 if (month_day < kMaximumDayInMaximumMonth) |
| 177 return true; | 177 return true; |
| 178 if (month_day > kMaximumDayInMaximumMonth) | 178 if (month_day > kMaximumDayInMaximumMonth) |
| 179 return false; | 179 return false; |
| 180 // (year, month, monthDay) = | 180 // (year, month, monthDay) = |
| 181 // (maximumYear, maximumMonthInMaximumYear, maximumDayInMaximumMonth) | 181 // (maximumYear, maximumMonthInMaximumYear, maximumDayInMaximumMonth) |
| 182 return !hour && !minute && !second && !millisecond; | 182 return !hour && !minute && !second && !millisecond; |
| 183 } | 183 } |
| 184 | 184 |
| 185 bool DateComponents::AddDay(int day_diff) { | 185 bool DateComponents::AddDay(int day_diff) { |
| 186 ASSERT(month_day_); | 186 DCHECK(month_day_); |
| 187 | 187 |
| 188 int day = month_day_ + day_diff; | 188 int day = month_day_ + day_diff; |
| 189 if (day > MaxDayOfMonth(year_, month_)) { | 189 if (day > MaxDayOfMonth(year_, month_)) { |
| 190 day = month_day_; | 190 day = month_day_; |
| 191 int year = year_; | 191 int year = year_; |
| 192 int month = month_; | 192 int month = month_; |
| 193 int max_day = MaxDayOfMonth(year, month); | 193 int max_day = MaxDayOfMonth(year, month); |
| 194 for (; day_diff > 0; --day_diff) { | 194 for (; day_diff > 0; --day_diff) { |
| 195 ++day; | 195 ++day; |
| 196 if (day > max_day) { | 196 if (day > max_day) { |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 712 case kWeek: | 712 case kWeek: |
| 713 return String::Format("%04d-W%02d", year_, week_); | 713 return String::Format("%04d-W%02d", year_, week_); |
| 714 case kInvalid: | 714 case kInvalid: |
| 715 break; | 715 break; |
| 716 } | 716 } |
| 717 ASSERT_NOT_REACHED(); | 717 ASSERT_NOT_REACHED(); |
| 718 return String("(Invalid DateComponents)"); | 718 return String("(Invalid DateComponents)"); |
| 719 } | 719 } |
| 720 | 720 |
| 721 } // namespace blink | 721 } // namespace blink |
| OLD | NEW |