Re: [whatwg] Week Strings

2009-07-14 Thread Smylers
Ian Hickson writes:

 On Fri, 19 Jun 2009, Smylers wrote:
 
  For input type=week elements the spec requires:
  
The value attribute, if specified, must have a value that is a valid
week string.
  
  -- http://www.whatwg.org/html5#week-state
  
  But the spec's HTML source contains this comment immediately afterwards:
  
!-- ok to set out-of-range value, we never know when we might have to
represent bogus input --
 
 it [...] means that there's no requirement that the value= be within
 the range given by min= and max=.

Thanks for clarifying that.

input type=week value=2010-W53
input type=week value=2010-W54
  
  If out-of-range week values are to be permitted in input elements
  then a validator should permit both of them.  Conversely if they
  aren't permitted then it should accept neither of them.
 
 Please report such bugs straight to Henri. :-)

Of course -- but I wanted to check what the correct behaviour was first.

Smylers


Re: [whatwg] Week Strings

2009-07-13 Thread Ian Hickson
On Fri, 19 Jun 2009, Smylers wrote:

 For input type=week elements the spec requires:
 
   The value attribute, if specified, must have a value that is a valid
   week string.
 
 -- http://www.whatwg.org/html5#week-state
 
 But the spec's HTML source contains this comment immediately afterwards:
 
   !-- ok to set out-of-range value, we never know when we might have to
   represent bogus input --

 Does that comment mean that the above requirement will be changed to
 something along the lines of must have a value that is a syntactically
 valid week string but may represent a week that doesn't actually exist?

No, it just means that there's no requirement that the value= be within 
the range given by min= and max=. It's a reminder to myself in case I 
notice there's no such requirement one day and go and add one thinking it 
was a mistake.


 That is, the author can seed a browser's week-picker control to a value 
 which the browser must not submit back to the server?

So long as it is a valid week string, yes.


 In general determining that something is a valid week string requires 
 knowing which day of the week the year in question begins on.  For 
 example 2009-W53 is a valid week string (because 2009 began on a 
 Thursday) but 2010-W53 isn't (because 2010 will begin on a Friday). 
 Browsers will need to do this to know whether they can submit a week 
 value.

Yup.


 The spec doesn't appear to provide an algorithm for determining which 
 day of the week a year begins on (however I am not a browser developer; 
 possibly this is sufficiently straightforward that those who are don't 
 need it spelling out).

As far as I can tell, it is well-defined in the spec.


 Currently Validator.nu accepts this:
 
   input type=week value=2010-W53
 
 but not this:
 
   input type=week value=2010-W54
 
 If out-of-range week values are to be permitted in input elements then 
 a validator should permit both of them.  Conversely if they aren't 
 permitted then it should accept neither of them (and therefore have to 
 implement a 'which day is January 1st' algorithm, which I'm guessing it 
 currently doesn't).

Please report such bugs straight to Henri. :-)

-- 
Ian Hickson   U+1047E)\._.,--,'``.fL
http://ln.hixie.ch/   U+263A/,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'


Re: [whatwg] Week Strings

2009-07-13 Thread Ian Hickson
On Fri, 19 Jun 2009, 'Smylers' wrote:

 And even states the blindingly obvious:
 
   The 'week number of the last day' of a week-year with 53 weeks is 53;
   the 'week number of the last day' of a week-year with 52 weeks is 52.

I use the term week number of the last day as a kind of function in the 
spec, so while it may be obvious, it has to be listed explicitly otherwise 
one could argue that it isn't defined. (I could probably just stop using 
it as a function and just assume that people will apply common sense, but 
sometimes that doesn't work so well...)

-- 
Ian Hickson   U+1047E)\._.,--,'``.fL
http://ln.hixie.ch/   U+263A/,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'


[whatwg] Week Strings

2009-06-19 Thread Smylers
For input type=week elements the spec requires:

  The value attribute, if specified, must have a value that is a valid
  week string.

-- http://www.whatwg.org/html5#week-state

But the spec's HTML source contains this comment immediately afterwards:

  !-- ok to set out-of-range value, we never know when we might have to
  represent bogus input --

Does that comment mean that the above requirement will be changed to
something along the lines of must have a value that is a syntactically
valid week string but may represent a week that doesn't actually exist?
That is, the author can seed a browser's week-picker control to a value
which the browser must not submit back to the server?

In general determining that something is a valid week string requires
knowing which day of the week the year in question begins on.  For
example 2009-W53 is a valid week string (because 2009 began on a
Thursday) but 2010-W53 isn't (because 2010 will begin on a Friday).
Browsers will need to do this to know whether they can submit a week
value.

The spec doesn't appear to provide an algorithm for determining which
day of the week a year begins on (however I am not a browser developer;
possibly this is sufficiently straightforward that those who are don't
need it spelling out).

Currently Validator.nu accepts this:

  input type=week value=2010-W53

but not this:

  input type=week value=2010-W54

If out-of-range week values are to be permitted in input elements then
a validator should permit both of them.  Conversely if they aren't
permitted then it should accept neither of them (and therefore have to
implement a 'which day is January 1st' algorithm, which I'm guessing it
currently doesn't).

Smylers


Re: [whatwg] Week Strings

2009-06-19 Thread Anne van Kesteren
On Fri, 19 Jun 2009 11:48:17 +0200, Smylers smyl...@stripey.com wrote:
 The spec doesn't appear to provide an algorithm for determining which
 day of the week a year begins on (however I am not a browser developer;
 possibly this is sufficiently straightforward that those who are don't
 need it spelling out).

It does actually, but it is not clearly linked from valid week and such:

  http://www.whatwg.org/specs/web-apps/current-work/#weeks


 If out-of-range week values are to be permitted in input elements then
 a validator should permit both of them.  Conversely if they aren't
 permitted then it should accept neither of them (and therefore have to
 implement a 'which day is January 1st' algorithm, which I'm guessing it
 currently doesn't).

Or maybe it implements the bogus one the specification previously defined.


-- 
Anne van Kesteren
http://annevankesteren.nl/


Re: [whatwg] Week Strings

2009-06-19 Thread Smylers
Anne van Kesteren writes:

 On Fri, 19 Jun 2009 11:48:17 +0200, Smylers smyl...@stripey.com
 wrote:
 
  The spec doesn't appear to provide an algorithm for determining
  which day of the week a year begins on (however I am not a browser
  developer; possibly this is sufficiently straightforward that those
  who are don't need it spelling out).
 
 It does actually, but it is not clearly linked from valid week and
 such:
 
   http://www.whatwg.org/specs/web-apps/current-work/#weeks

That says that 1969 December 29th was a Monday, but doesn't appear to
give an algorithm for answering the question Will the year 2010 begin
on a Thursday?.

Smylers


Re: [whatwg] Week Strings

2009-06-19 Thread Křištof Želechovski
An algorithm for calculating the weekday of Jan. 1st given a year would be
outside the scope of the HTML specification.  Similarly, the HTML
specification does not describe how you increment a number by 1.
IMHO,
Chris




Re: [whatwg] Week Strings

2009-06-19 Thread 'Smylers'
Křištof Želechovski writes:

 An algorithm for calculating the weekday of Jan. 1st given a year
 would be outside the scope of the HTML specification.

That's begging the question.

 Similarly, the HTML specification does not describe how you increment
 a number by 1.

No, but it does explain how to interpret a sequence of digits as an
integer (multiplying the value by 10 for each digit encountered).  And
defines that week is a period of 7 days.  And defines how many days
there are in each month of a year.  And even states the blindingly
obvious:

  The 'week number of the last day' of a week-year with 53 weeks is 53;
  the 'week number of the last day' of a week-year with 52 weeks is 52.

Those things all seem much more obvious to me than working out which day
January 1st of a given year is.  But as I said, I'm not a browser
developer so perhaps it's fine.

Smylers


Re: [whatwg] Week Strings

2009-06-19 Thread timeless
On Fri, Jun 19, 2009 at 2:32 PM, Smylerssmyl...@stripey.com wrote:
  The 'week number of the last day' of a week-year with 53 weeks is 53;
  the 'week number of the last day' of a week-year with 52 weeks is 52.

well... there are people who might think you could count from week 0
if weeks are numbered from the first whole week. there are all sorts
of ways to get numbering wrong. (I've been at a place which has both
53 and 0 ...)


Re: [whatwg] Week Strings

2009-06-19 Thread Křištof Želechovski
An algorithm to calculate the weekday of Jan. 1th given a year is not
obvious at all.  Just the opposite: the more obvious an external fact is,
the easier (and more appropriate) it is to incorporate it to the
specification because it does not cause any distraction from the main
subject.
Cheers,
Chris



Re: [whatwg] Week Strings

2009-06-19 Thread Smylers
timeless writes:

 On Fri, Jun 19, 2009 at 2:32 PM, Smylerssmyl...@stripey.com wrote:
 
   The 'week number of the last day' of a week-year with 53 weeks is 53;
   the 'week number of the last day' of a week-year with 52 weeks is 52.
 
 well... there are people who might think you could count from week 0

Except that the spec has already defined that a year starts on week 1
before the above sentence.

Smylers


Re: [whatwg] Week Strings

2009-06-19 Thread j...@eatyourgreens.org.uk
Getting the day of the week, in the Gregorian calendar, for a given date is
pretty straightforward. I thought we publihsed it online somehwere on the
Royal Observatory website, but I can't find it. However, wikipedia has the
algorithm:
http://en.wikipedia.org/wiki/Calculating_the_day_of_the_week#An_algorithm_to
_calculate_the_day_of_the_week

Cheers
Jim O'Donnell

Original Message:
-
From: K�i�tof �elechovski giecr...@stegny.2a.pl
Date: Fri, 19 Jun 2009 13:39:55 +0200
To: smyl...@stripey.com, whatwg@lists.whatwg.org
Subject: Re: [whatwg] Week Strings


An algorithm to calculate the weekday of Jan.�1th given a year is not
obvious at all.  Just the opposite: the more obvious an external fact is,
the easier (and more appropriate) it is to incorporate it to the
specification because it does not cause any distraction from the main
subject.
Cheers,
Chris




mail2web LIVE – Free email based on Microsoft® Exchange technology -
http://link.mail2web.com/LIVE