[pmwiki-users] Manipulating dates with MarkupExpressions & ZAP
pmwiki at alboldt.de
Sat Jun 9 13:31:10 CDT 2007
I've got two aproaches to that kind of problem (used in a project plan
managed by pmwiki), although I enter the date directly, not using ZAP:
1. you could set fields with that form input into your page like:
and reprocess this using rospatterns calling a date parsing routine
(attached a drfat version of such a routine for german date formats).
This way you could translate any entered date format (d.m. dd.mm.
dd.mm.yyyy yyyy/mm/dd yy/d/d etc) into one valid date format you could
use then by referencing the pagetextvar $:start. for parsing you could
use a common routine (like e.g. already distrubuted within pmwiki, but
dont know where you can find it and its name, have to search ...)
So the User would e.g enter:
ZAP will enter this value into the line:
and saving the page will transform this via rospattern into:
rospattern could be:
$ROSPatterns['/:start:(.*)'] = '(array)parsedate("$1")'; (not quite
sure, how to pass back only the first item of a returned array when
calling a function, or you have to create a wrappper, which extracts the
first item and apssed this to rospattern.
2. you can setup a markup to display any entered date-like format in one
unique format. example:
markup will call function which uses the parsedate-routine
list($fromto,$from,$to) = ParseDate($datetime,'','','');
$fromto = str_replace('bis','(:nl:)bis',$fromto);
return PRR("(:cellnr class=taburlaubwann title='$datetime' :)".$fromto);
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the pmwiki-users