Bug 33986 - HTMLInputElement::valueAsDate setter support for type=week.
Summary: HTMLInputElement::valueAsDate setter support for type=week.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: 528+ (Nightly build)
Hardware: Other OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: 32697
  Show dependency treegraph
 
Reported: 2010-01-21 20:41 PST by Kent Tamura
Modified: 2010-01-24 18:17 PST (History)
2 users (show)

See Also:


Attachments
Proposd patch (11.56 KB, patch)
2010-01-21 20:44 PST, Kent Tamura
no flags Details | Formatted Diff | Diff
Proposed patch (rev.2) (11.68 KB, patch)
2010-01-21 21:09 PST, Kent Tamura
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kent Tamura 2010-01-21 20:41:38 PST
HTMLInputElement::valueAsDate setter support for type=week.
Comment 1 Kent Tamura 2010-01-21 20:44:06 PST
Created attachment 47173 [details]
Proposd patch
Comment 2 Kent Tamura 2010-01-21 20:46:30 PST
This is the last patch for HTMLInputElement::valueAsDate!
Comment 3 Eric Seidel (no email) 2010-01-21 20:58:40 PST
Attachment 47173 [details] did not build on mac:
Build output: http://webkit-commit-queue.appspot.com/results/203576
Comment 4 Kent Tamura 2010-01-21 21:09:05 PST
Created attachment 47174 [details]
Proposed patch (rev.2)
Comment 5 Darin Adler 2010-01-22 09:28:59 PST
Comment on attachment 47174 [details]
Proposed patch (rev.2)

> +debug('Around Geregorian calendar starting year:');

Typo: "Geregorian".

> +// Gregorian calendar started in 1582. We don't suuprot that year.

Typo: "suuprot".

>      case Week: {
> -        // Offset from January 1st to Monday of the ISO 8601's first week.
> -        //   ex. If January 1st is Friday, such Monday is 3 days later.
> -        int offsetTo1stWeekStart = 1 - dayOfWeek(m_year, 0, 1);
> -        if (offsetTo1stWeekStart <= -4)
> -            offsetTo1stWeekStart += 7;
> -        return (dateToDaysFrom1970(m_year, 0, 1) + offsetTo1stWeekStart + (m_week - 1) * 7) * msPerDay;
> +        return (dateToDaysFrom1970(m_year, 0, 1) + offsetTo1stWeekStart(m_year) + (m_week - 1) * 7) * msPerDay;
>      }

Should get rid of the unneeded braces here.
Comment 6 Kent Tamura 2010-01-24 18:17:23 PST
Thank you for the review.

(In reply to comment #5)
> (From update of attachment 47174 [details])
> > +debug('Around Geregorian calendar starting year:');
> 
> Typo: "Geregorian".

Fixed.

> > +// Gregorian calendar started in 1582. We don't suuprot that year.
> 
> Typo: "suuprot".

Fixed.

> >      case Week: {
> > -        // Offset from January 1st to Monday of the ISO 8601's first week.
> > -        //   ex. If January 1st is Friday, such Monday is 3 days later.
> > -        int offsetTo1stWeekStart = 1 - dayOfWeek(m_year, 0, 1);
> > -        if (offsetTo1stWeekStart <= -4)
> > -            offsetTo1stWeekStart += 7;
> > -        return (dateToDaysFrom1970(m_year, 0, 1) + offsetTo1stWeekStart + (m_week - 1) * 7) * msPerDay;
> > +        return (dateToDaysFrom1970(m_year, 0, 1) + offsetTo1stWeekStart(m_year) + (m_week - 1) * 7) * msPerDay;
> >      }
> 
> Should get rid of the unneeded braces here.

Fixed.

Landed as r53787.