OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
79 String MonthInputType::serializeWithMilliseconds(double value) const | 79 String MonthInputType::serializeWithMilliseconds(double value) const |
80 { | 80 { |
81 DateComponents date; | 81 DateComponents date; |
82 if (!date.setMillisecondsSinceEpochForMonth(value)) | 82 if (!date.setMillisecondsSinceEpochForMonth(value)) |
83 return String(); | 83 return String(); |
84 return serializeWithComponents(date); | 84 return serializeWithComponents(date); |
85 } | 85 } |
86 | 86 |
87 Decimal MonthInputType::defaultValueForStepUp() const | 87 Decimal MonthInputType::defaultValueForStepUp() const |
88 { | 88 { |
89 double current = currentTimeMS(); | 89 double current = convertToLocalTime(currentTimeMS()); |
90 double utcOffset = calculateUTCOffset(); | |
91 double dstOffset = calculateDSTOffset(current, utcOffset); | |
92 int offset = static_cast<int>((utcOffset + dstOffset) / msPerMinute); | |
93 current += offset * msPerMinute; | |
94 | |
95 DateComponents date; | 90 DateComponents date; |
96 date.setMillisecondsSinceEpochForMonth(current); | 91 date.setMillisecondsSinceEpochForMonth(current); |
tkent
2014/07/28 00:40:26
nit:
date.setMillisecondsSinceEpochForMonth(conver
kangil_
2014/07/31 00:45:45
Done.
| |
97 double months = date.monthsSinceEpoch(); | 92 double months = date.monthsSinceEpoch(); |
98 ASSERT(std::isfinite(months)); | 93 ASSERT(std::isfinite(months)); |
99 return Decimal::fromDouble(months); | 94 return Decimal::fromDouble(months); |
100 } | 95 } |
101 | 96 |
102 StepRange MonthInputType::createStepRange(AnyStepHandling anyStepHandling) const | 97 StepRange MonthInputType::createStepRange(AnyStepHandling anyStepHandling) const |
103 { | 98 { |
104 DEFINE_STATIC_LOCAL(const StepRange::StepDescription, stepDescription, (mont hDefaultStep, monthDefaultStepBase, monthStepScaleFactor, StepRange::ParsedStepV alueShouldBeInteger)); | 99 DEFINE_STATIC_LOCAL(const StepRange::StepDescription, stepDescription, (mont hDefaultStep, monthDefaultStepBase, monthStepScaleFactor, StepRange::ParsedStepV alueShouldBeInteger)); |
105 | 100 |
106 return InputType::createStepRange(anyStepHandling, Decimal::fromDouble(month DefaultStepBase), Decimal::fromDouble(DateComponents::minimumMonth()), Decimal:: fromDouble(DateComponents::maximumMonth()), stepDescription); | 101 return InputType::createStepRange(anyStepHandling, Decimal::fromDouble(month DefaultStepBase), Decimal::fromDouble(DateComponents::minimumMonth()), Decimal:: fromDouble(DateComponents::maximumMonth()), stepDescription); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
158 layoutParameters.placeholderForMonth = "--"; | 153 layoutParameters.placeholderForMonth = "--"; |
159 layoutParameters.placeholderForYear = "----"; | 154 layoutParameters.placeholderForYear = "----"; |
160 } | 155 } |
161 | 156 |
162 bool MonthInputType::isValidFormat(bool hasYear, bool hasMonth, bool hasWeek, bo ol hasDay, bool hasAMPM, bool hasHour, bool hasMinute, bool hasSecond) const | 157 bool MonthInputType::isValidFormat(bool hasYear, bool hasMonth, bool hasWeek, bo ol hasDay, bool hasAMPM, bool hasHour, bool hasMinute, bool hasSecond) const |
163 { | 158 { |
164 return hasYear && hasMonth; | 159 return hasYear && hasMonth; |
165 } | 160 } |
166 #endif | 161 #endif |
167 } // namespace blink | 162 } // namespace blink |
OLD | NEW |