Bug 1310078 - Implement valueAsNumber and valueAsDate for <input type=datetime-local>

This commit is contained in:
janekptacijarabaci 2018-03-30 19:11:11 +02:00 committed by Roy Tam
commit 344ea39e20
6 changed files with 351 additions and 26 deletions

View file

@ -1075,11 +1075,7 @@ protected:
/**
* Returns if valueAsNumber attribute applies for the current type.
*/
bool DoesValueAsNumberApply() const
{
// TODO: this is temporary until bug 888331 is fixed.
return DoesMinMaxApply() && mType != NS_FORM_INPUT_DATETIME_LOCAL;
}
bool DoesValueAsNumberApply() const { return DoesMinMaxApply(); }
/**
* Returns if autocomplete attribute applies for the current type.
@ -1287,6 +1283,7 @@ protected:
* https://html.spec.whatwg.org/multipage/infrastructure.html#valid-normalised-local-date-and-time-string
*/
void NormalizeDateTimeLocal(nsAString& aValue) const;
/**
* This methods returns the number of days since epoch for a given year and
* week.
@ -1317,6 +1314,13 @@ protected:
*/
uint32_t MaximumWeekInYear(uint32_t aYear) const;
/**
* This method converts aValue (milliseconds within a day) to hours, minutes,
* seconds and milliseconds.
*/
bool GetTimeFromMs(double aValue, uint16_t* aHours, uint16_t* aMinutes,
uint16_t* aSeconds, uint16_t* aMilliseconds) const;
/**
* This methods returns true if it's a leap year.
*/