CaledarWidget to handle incomplete dates (patch)

Mikko Ohtamaa <[email protected]>
Newsgroups gmane.comp.web.zope.plone.archetypes.devel
Message-ID <[email protected]>
Hi,

One cannot enter incomplete dates (missing month or day) with CalendarWidget. 
This is problem for a client who needs to enter date approximations. Especially 
because setting date SILENTLY FAILS if day or month is unset. It's against 
usability to fill in random values to month or day, just to make it work.

I reworked AT 1.3.7 CalendarWidget a bit. Now one can set default_day and 
default_month properties which are used for missing day or month entries. Date 
format caused some problems, since value string seem to vary between YYYYY-MM-DD 
and YYYY/MM/DD. You cannot do this change at field level, since DateTimeField 
uses DateTime object and DateTime doens't support invalid (zero) month or days.

I opened a trac entry with patch for this:
https://dev.plone.org/plone/ticket/5251

Unit test is missing. Dealing with date strings is quite dangerous so I hope I 
catched all possible cases; feedback is welcome. 

Cheers,
Mikko Ohtamaa
Oulu, Finland





-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.