Annoyed - Python 2.2.1 BUG in calendar module
Steve Holden
sholden at holdenweb.com
Thu Oct 3 16:17:02 EDT 2002
"Kaleb Pederson" <kibab at icehouse.net> wrote in message
news:mailman.1033664407.19258.python-list at python.org...
> Ok. I just finished a PyQt date widget wherein I created a wrapper
> around the calendar module to use as my backend. The Calendar module,
> however, doesn't explicitly say that it doesn't work for dates pre-1970.
> The best case is that this is a DOCUMENTATION BUG. I would prefer to
> see a more powerful date module that starts at the beginning of the
> Gregorian calendar.
>
> What the documentation does say:
>
> From http://www.python.org/doc/current/lib/module-calendar.html:
>
> weekday(year, month, day) - Returns the day of the week (0 is Monday)
> for year (1970-...), month (1-12), day (1-31).
>
I should say this is a pretty explicit statement that dates can't be before
1970.
> // I figured that was fine, I can avoid using that function in my
> wrapper
>
> timegm(tuple) - An unrelated but handy function that takes a time tuple
> such as returned by the gmtime() function in the time module, and
> returns the corresponding Unix timestamp value, assuming an epoch of
> 1970, and the POSIX encoding. In fact, time.gmtime() and timegm() are
> each others' inverse.
>
And this promises you that dates are based on a starting point of 1970. RTFM
;-)
> // Okay, I can avoid that too, especially since it is "unrelated"
>
> I probably should have got a clue based on the above, but I didn't....
>
We all have our blind spots :-)
> Well, anyone have a different calendar module that isn't limited like
> the Python one that happens to be available? I would prefer one that
> was API compatible.
>
> If not, I'm off to write my own.
>
It's hard to say what you need from calednar. It would probably be worth a
look at mxDateTime and then snitching the code from calendar to build around
it.
regards
-----------------------------------------------------------------------
Steve Holden http://www.holdenweb.com/
Python Web Programming http://pydish.holdenweb.com/pwp/
Previous .sig file retired to www.homeforoldsigs.com
-----------------------------------------------------------------------
More information about the Python-list
mailing list