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

Tres Seaver tseaver@zope.com
25 Sep 2002 07:30:03 -0400


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 )
Tres.
-- 
===============================================================
Tres Seaver                                tseaver@zope.com
Zope Corporation      "Zope Dealers"       http://www.zope.com