[Solar-talk] Date Fields

Kilbride, James P. James.Kilbride at gd-ais.com
Fri May 2 11:32:17 CDT 2008


Oh that is very interesting Paul.. very interesting indeed.. I'm going
to have to play with those. I just used timestamp just now to play with
things and I have to say I like it. Are the year's static or can I
provide an array on 'acceptable' years?

James Kilbride 

-----Original Message-----
From: solar-talk-bounces at lists.solarphp.com
[mailto:solar-talk-bounces at lists.solarphp.com] On Behalf Of Paul M Jones
Sent: Friday, May 02, 2008 11:51 AM
To: solar-talk at lists.solarphp.com
Subject: Re: [Solar-talk] Date Fields


On May 2, 2008, at 11:36 , Kilbride, James P. wrote:
> So, when putting date fields on forms what do people like to use for 
> the format and are there any helpers that people have for dates that 
> make it easier for people to enter them 'correctly'?
>

Just added some stuff in SVN earlier this week (late last week?) that
helps with this.

First, the validate and sanitize filters for date/time/timestamp now
additionally take array values, where the keys map to date() format keys
(Y, m, d, H, i, s).  Validate will attempt to validate an array with
those keys, and sanitize will take an array with those keys and convert
it into an ISO string.  (This is in addition to the previously existing
behavior of validating and sanitizing strings.)

Once that was in place, I added view helpers formDate, formTime, and
formTimestamp().  These present the temporal values as a series of
select/options, so you can pick the year, month, day, hour, and minute
separately.  They return the individual values as part of an array, so
the validate and sanitize filters will pick them up and handle them
correctly.

You can see some of the relevant code here:

   <http://solarphp.com/svn/trunk/Solar/Filter/ValidateIsoTimestamp.php>

   <http://solarphp.com/svn/trunk/Solar/Filter/SanitizeIsoTimestamp.php>

   <http://solarphp.com/svn/trunk/Solar/View/Helper/FormTimestamp.php>

(The "date" and "time" versions of these are highly similar.)

Hope this helps, please let me know if it does not.


-- pmj
_______________________________________________
Solar-talk mailing list
Solar-talk at lists.solarphp.com
http://mailman-mail3.webfaction.com/listinfo/solar-talk



More information about the Solar-talk mailing list