Bug 33986

Summary: HTMLInputElement::valueAsDate setter support for type=week.
Product: WebKit Reporter: Kent Tamura <tkent>
Component: FormsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: darin, eric
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Other   
OS: OS X 10.5   
Bug Depends on:    
Bug Blocks: 32697    
Attachments:
Description Flags
Proposd patch
none
Proposed patch (rev.2) darin: review+

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.