git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/1] gitweb: javascript ability to adjust time based on timezone

From
Jakub Narebski <jnareb@gmail.com>
Date
Mar 24, 2011, 23:36 UTC
Message-ID
<201103250036.49662.jnareb@gmail.com>
In-Reply-To
<4D8BCE0D.3080504@eaglescrag.net>
On Fri, 25 Mar 2011, J.H. wrote:
> On 03/24/2011 01:19 PM, Jakub Narebski wrote:
>> On Thu, 24 Mar 2011, Kevin Cernekee wrote:
Show 23 quoted lines
>>> 4) IE6 does not seem to like ISO 8601 format:
>>>
>>> x = new Date("2011-03-09T03:29:09Z");
>>>
>>> This sets all fields to NaN.  I suspect that getTime() values
>>> (milliseconds since 1970-01-01) are more portable.
>> 
>> Do you mean using epoch in title attribute, or fallback to parsing
>> ISO 8601 UTC format with regexps?
> 
> Parsing it with regexps is doable if completely inelegant, that said
> this is Javascript...
> 
> Looky that MS provides Virtual PC images for compat testing for IE6
> http://www.microsoft.com/downloads/en/details.aspx?FamilyID=21eabb90-958f-4b64-b5f1-73d0a413c8ef&displaylang=en
> 
> Ok reading through the documentation I can find for MS and their
> Date.parse (
> http://msdn.microsoft.com/en-us/library/dctx55bc(v=VS7.1).aspx ) and
> some quick experimentation:
> 
> 2011-03-09 - breaks
> 2011/03/09 - works
I really don't like using '/' as a separator; not only this is not
ISO-8601, but it is easy to confuse with insane American way of
writing dates with MM/DD/YYYY (day in the middle).
 
> 2011/03/09T01:01:01  - works, sorta - the hour comes out as 10 vs. 01
> 2011/03/09 01:01:01  - works, hour is correct
> 2011/03/09 01:01:01Z - works and seems to get the TZ correct
> 2011/03/09T01:01:01Z - breaks
If it worked in all (or almost all) web browsers with
  2011-03-09 01:01:01Z - works and seems to get the TZ correct
then I would say go for it - this variant of ISO-8601 with ' ' instead
of 'T' to separate date part from time part is more human-readable.
 
Show 8 quoted lines
> Not really sure what the "right" way to fix this is going to end up
> being.  Suppose our options are:
> 
> 1) Try and find a format that is generally accepted and parseable on all
> the browsers
> 2) Declare IE6 an unsupported browser
> 3) Trap what browser we are on and do a regex parsing of the string and
> do appropriate sets or a more verbose format that works everywhere

If web browser returned undefined value if they can't parse date, then we could do regexp parsing based on this, not on user-string (which is in most cases wrong solution).

Show 10 quoted lines
> 4) Use a regex and sets for every browser.
> 5) Switch all the embedded times over to epochs in the title=""'s
> 
> 4 is probably the "most" right that I can see of those options, and
> avoids possible other browser inconsistencies with respect to date
> parsing.  I'm going to code that up (it shouldn't be terribly
> complicated), unless someone likes one of the other ideas better.
> Suppose we could even go down the more complicate microformat route and
> just write some code to parse that, just more complicated all the way
> around.
Right.
> 5 has the appeal that everything handles the epoch correctly, but it
> does have the downside of being less readable in the html code (and
> shifts us slightly further away from the accepted "standard" of the
> microcode formats)
Well, we could always use non-standard 'epoch' attribute, or something...
 
-- 
Jakub Narebski
Poland
Previous: J.H.Next: Jakub Narebski
Message 26 of 36 in “gitweb: rename parse_date() to format_date()”
  1. 1/2 gitweb: rename parse_date() to format_date()Kevin Cernekee, Mar 19, 2011
  2. 2/2 gitweb: introduce localtime featureKevin Cernekee, Mar 19, 2011
  3. Jakub NarebskiMar 19, 2011
  4. Junio C HamanoMar 19, 2011
  5. Kevin CernekeeMar 19, 2011
  6. Jakub NarebskiMar 19, 2011
  7. Kevin CernekeeMar 19, 2011
  8. Jakub NarebskiMar 19, 2011
  9. J.H.Mar 20, 2011
  10. Kevin CernekeeMar 20, 2011
  11. Jakub NarebskiMar 21, 2011
  12. J.H.Mar 21, 2011
  13. Jakub NarebskiMar 21, 2011
  14. Piotr KrukowieckiMar 21, 2011
  15. J.H.Mar 21, 2011
  16. Jakub NarebskiMar 21, 2011
  17. 0/1 Gitweb: Change timezoneJohn 'Warthog9' Hawley, Mar 24, 2011
  18. 1/1 gitweb: javascript ability to adjust time based on timezoneJohn 'Warthog9' Hawley, Mar 24, 2011
  19. Kevin CernekeeMar 24, 2011
  20. J.H.Mar 24, 2011
  21. Jakub NarebskiMar 24, 2011
  22. Jakub NarebskiMar 24, 2011
  23. Kevin CernekeeMar 24, 2011
  24. J.H.Mar 24, 2011
  25. J.H.Mar 24, 2011
  26. Jakub NarebskiMar 24, 2011
  27. Jakub NarebskiMar 24, 2011
  28. gitweb: Fix handling of fractional timezones in parse_dateJakub Narebski, Mar 25, 2011
  29. Kevin CernekeeMar 25, 2011
  30. gitweb: Fix handling of fractional timezones in parse_dateJakub Narebski, Mar 25, 2011
  31. Junio C HamanoMar 25, 2011
  32. Jakub NarebskiMar 25, 2011
  33. gitweb: Fix handling of fractional timezones in parse_dateJakub Narebski, Mar 25, 2011
  34. Jakub NarebskiMar 19, 2011
  35. Jon SeymourMar 19, 2011
  36. Junio C HamanoMar 19, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.