[Zope-CMF] CMFDefault EffectiveDate, DateTime.ISO() and TZ offset

Florent Guillaume fg@nuxeo.com
Thu, 26 Sep 2002 16:18:24 +0000 (UTC)


I put this in the collector for future reference.
http://collector.zope.org/CMF/60

Florent

Tres Seaver  <tseaver@zope.com> wrote:
> On Wed, 2002-09-25 at 01:16, sean.upton@uniontrib.com wrote:
> > Out of curiosity, is it expected behavior that DateTime.ISO(), and by
> > extension, EffectiveDate() in DefaultDublinCoreImpl, that the time zone
> > offset is stripped off, forcing code to directly use the effective_date
> > attribute instead of EffectiveDate()... I realize that this works fine, but
> > I sort-of expected EffectiveDate to preserve TZ offset. Thoughts?
> 
> This is actually a bug in DateTime's ISO() method, which claims to be
> supporting the stsndard, but strips the zone qualifier.  It should
> either convert to UTC, and append 'Z' for Zulu, or else append a
> fully-extended qualifier (in the form '[-+]hh:mm').
> 
> In the meanwhile, we should probably modify '{Creation,Effective,
> Expiration,Modification}Date' to do one of two things:
> 
>   - Convert to Zulu, and display with the trailing 'Z' (easier,
>     but may be confusing for humans).
> 
>   - Append the true ISO8601 zone quelifier, e.g.::
> 
>       def zoneISO8601( self, d ):
> 
>           """ Return the ISO8601 zone qualifier for DateTime, 'd'.
>           """
>           from DateTime.DateTime import _tzoffset
>           fset = _tzoffset( d._tz, int( d ) )
>           return '%+03d:%02d' % ( fset / 3600, abs( fset ) % 3600 )
-- 
Florent Guillaume, Nuxeo (Paris, France)
+33 1 40 33 79 87  http://nuxeo.com  mailto:fg@nuxeo.com