[Dev] Upcoming Chandler date/time related changes
vajda at osafoundation.org
Tue May 24 16:38:51 PDT 2005
>> Index: parcels/osaf/examples/zaobao/parcel.xml
>> - <delay>00:00:30:00</delay>
>> + <delay>0+1800.0</delay>
> This looks unfortunate, I don't understand the new format. The old
> format seems clearer.
Yes, it is and I fixed it already. Both formats are allowed, the
not-so-readable one being internal. My bad.
>> +from datetime import datetime
> This is just a general note about from vs import. I think we determined
> that import is better, so things like this would be better to write:
> import datetime.datetime as datetime
We was wrong. I do not ever use the 'import blah as blah' as it leads to
slower code since for every symbol you use in blah you must look it up
everytime. The 'from blah import foo, bar, baz' form is more efficient and
How do you like to type datetime.datetime.now() all the time anyway ?
>> +from PyICU import GregorianCalendar, DateFormatSymbols
>> +dateFormatSymbols = DateFormatSymbols()
> This looks weird. Maybe python gurus can weigh in if this should be changed.
What's weird about this ? I'm caching the DateFormatSymbols() for the current
locale in a module variable called dateFormatSymbols.
>> + timeString = "%d:%s" %((time.hour % 12) or 12,
>> + time.strftime("%M %p"))
> Shouldn't the time format come from locale (24 vs 12 hours)?
Yes, definitely, this is one of the may areas that need localization in the
>> - monthText = selectedDate.Format("%B %Y")
>> + monthText = "%s %d" %(months[selectedDate.month].toUnicode(),
>> + selectedDate.year)
>> - monthText = "%s - %s" % (startDate.Format("%B"),
>> - lastDate.Format("%B %Y"))
>> + monthText = "%s - %s %d" %(months[startDate.month].toUnicode(),
>> + months[lastDate.month].toUnicode(),
>> + lastDate.year)
> I think this stuff might also be locale dependent (in which order to put
> things in a date).
>> - dayName = currentDate.Format('%a ') + str(currentDate.day)
>> + dayName = "%s %02d" %(shortWeekDays[actualDay + 1].toUnicode(),
>> + currentDate.day)
> Locale dependent order, maybe.
>> - dateTimeFormat = '%Y-%m-%d %I:%M %p'
>> - dateFormat = '%Y-%m-%d'
>> + #dateTimeFormat = '%Y-%m-%d %I:%M %p'
>> + #dateFormat = '%Y-%m-%d'
>> + #dateTimeFormatHint = 'yyyy-mm-dd HH:MM'
>> + #dateFormatHint = 'yyyy-mm-dd'
>> + dateTimeFormat = 'yyyy-MM-dd hh:mm a'
>> + dateFormat = 'yyyy-MM-dd'
>> dateTimeFormatHint = 'yyyy-mm-dd HH:MM'
>> dateFormatHint = 'yyyy-mm-dd'
> Locale specific formats.
Actually no, these are based on the standard ISO format. But still, the
locale specific ones might be better used here.
More information about the Dev