[Zope-CMF] Re: DateTime support for Norwegian dateformat? (offtopic)

jkpikifi jkp@iki.fi
Fri, 21 Dec 2001 11:49:06 -0000


for zope 2.3.0, I hope I extracted it right, I had some other datetime
diffs also so the line numbers are probably off:

***************
*** 930,935 ****
--- 950,956 ----
              while i < l and string[i] in spaces    : i=3Di+1
              if i < l and string[i] in delimiters:
                  d=3Dstring[i]
+               dels.append(d)
                  i=3Di+1
              else: d=3D''
              while i < l and string[i] in spaces    : i=3Di+1
***************
*** 995,1002 ****
                  day=3Dints[0]
                  del ints[:1]
              else:
!                 month=3Dints[0]
!                 day=3Dints[1]
                  del ints[:2]
          elif month:
              if len(ints) > 1:
--- 1016,1027 ----
                  day=3Dints[0]
                  del ints[:1]
              else:
!                 if ints[1] <=3D 12 and '.' in dels:
!                     day=3Dints[0]
!                     month=3Dints[1]
!                 else:
!                     day=3Dints[1]
!                     month=3Dints[0]
                  del ints[:2]
          elif month:
              if len(ints) > 1:
***************
*** 1026,1041 ****
                      month=3Dints[0]
              elif ints[2] > 31:
                  year=3Dints[2]
!                 if ints[0] > 12:
                      day=3Dints[0]
                      month=3Dints[1]
                  else:
                      day=3Dints[1]
                      month=3Dints[0]
!             elif ints[0] <=3D 12:
                  month=3Dints[0]
                  day=3Dints[1]
                  year=3Dints[2]
              del ints[:3]

          if day is None:
--- 1051,1074 ----
                      month=3Dints[0]
              elif ints[2] > 31:
                  year=3Dints[2]
!                 if ints[1] <=3D 12 and '.' in dels:
                      day=3Dints[0]
                      month=3Dints[1]
                  else:
                      day=3Dints[1]
                      month=3Dints[0]
!             elif ints[1] > 12:
                  month=3Dints[0]
                  day=3Dints[1]
                  year=3Dints[2]
+           elif '/' in dels:
+               if ints[0] >=3D 1900:
+                   year=3Dints[0]
+                   month=3Dints[1]
+                     day=3Dints[2]
+               else:
+                     month=3Dints[0]
+                     day=3Dints[1]
+                     year=3Dints[2]
+           elif '.' in dels:
+                 day=3Dints[0]
+                 month=3Dints[1]
+                 year=3Dints[2]
              del ints[:3]

          if day is None:


--- In zopeCMF@y..., "Andreas Jung" <andreas@a...> wrote:
> Someone having a patch ?
> 
> Andreas
> ----- Original Message -----
> From: "Joachim Schmitz" <js@a...>
> To: "Andreas Jung" <andreas@z...>; <Zope-CMF@z...>
> Sent: Friday, December 21, 2001 04:22
> Subject: Re: [Zope-CMF] DateTime support for Norwegian dateformat?
> 
> 
> but beware of a bug-feature.
> 
> 
> DateTime('13.1.2001') --> results correctly to 13-Jan-2001
> but
> DateTime('12.1.2001') --> results to 1-Dec-2001
> 
> and so do all others where the daydigits result in a valid month !!!!!
> 
> 
> --On Donnerstag, Dezember 20, 2001 14:13:59 -0500 Andreas Jung
> <andreas@z...> wrote:
> 
> > Zopes DateTime objects should be able to parse formats
> > like 'dd.mm.yy' and 'dd.mm.YYYY' (tested and working
> > with Zope 2.5 (and earlier version)).
> >
> > Andreas
> >
> >    
---------------------------------------------------------------------
> >    -    Andreas Jung                            Zope Corporation 
     -
> >   -   EMail: andreas@z...                http://www.zope.com      -
> >  -  "Python Powered"                       http://www.python.org     -
> >   -   "Makers of Zope"                       http://www.zope.org 
    -
> >    -                  "Life is a fulltime occupation"            
     -
> >    
---------------------------------------------------------------------
> >
> > ----- Original Message -----
> > From: "jkpikifi" <jkp@i...>
> > To: <Zope-CMF@z...>
> > Sent: Thursday, December 20, 2001 14:01
> > Subject: Re: [Zope-CMF] DateTime support for Norwegian dateformat?
> >
> >
> >> Yes, I've done that, I think I have the patches somewhere.  If you
> >> still need them, email me and I'll dig them up.  Or you could try
> >> looking them up at the zope bug collecter, I think I've submitted
them
> >>  there.
> >>
> >> --- In zopeCMF@y..., Sigve Tjora <public@t...> wrote:
> >> > Hi!
> >> >
> >> > Does anybody know if DateTime has support for Norwegian
date-formats
> >> like
> >> > dd.mm.yy or dd.mm.YYYY?
> >> >
> >> > Is it possible to modify DateTime so the constructor accepts these
> >> kind of
> >> > formats ok?
> >> >
> >> > mvh Sigve Tjora
> >> >
> >> >
> >> > _______________________________________________
> >> > Zope-CMF maillist  -  Zope-CMF@z...
> >> > http://lists.zope.org/mailman/listinfo/zope-cmf
> >> >
> >> > See http://www.zope.org/Products/PTK/Tracker for bug reports and
> >> feature requests
> >>
> >>
> >> _______________________________________________
> >> Zope-CMF maillist  -  Zope-CMF@z...
> >> http://lists.zope.org/mailman/listinfo/zope-cmf
> >>
> >> See http://www.zope.org/Products/PTK/Tracker for bug reports and
feature
> > requests
> >>
> >
> >
> > _______________________________________________
> > Zope-CMF maillist  -  Zope-CMF@z...
> > http://lists.zope.org/mailman/listinfo/zope-cmf
> >
> > See http://www.zope.org/Products/PTK/Tracker for bug reports and
feature
> > requests
> 
> 
> 
> Mit freundlichen Gr=FC=DFen
> 
> Joachim Schmitz
> 
> AixtraWare, Ing. B=FCro f=FCr Internetanwendungen
> H=FCsgenstr. 33a, D-52457 Aldenhoven
> Telefon: +49-2464-8851, FAX: +49-2464-905163
> 
> 
> _______________________________________________
> Zope-CMF maillist  -  Zope-CMF@z...
> http://lists.zope.org/mailman/listinfo/zope-cmf
> 
> See http://www.zope.org/Products/PTK/Tracker for bug reports and feature
> requests
> 
> 
> 
> _______________________________________________
> Zope-CMF maillist  -  Zope-CMF@z...
> http://lists.zope.org/mailman/listinfo/zope-cmf
> 
> See http://www.zope.org/Products/PTK/Tracker for bug reports and
feature requests