Date Format
bugs:341[link1]1. The problem
The default formatting for dates and times in WackoWiki[link3] is pretty much hard coded thru out the PHP code. The day.month.year and year-month-day formats aren't natural for us westerners to read.2. The solution
Adding some config options which allow the user to set the string passed into thedate()
function.3. A patch
I've done an implementation from R4.2. You can download the patch here[link4]. The patch doesn't add defaults to 'wakka.config.php' file, so unless you're gonna re-run wacko setup you will need to add these manually. See the code block below.4. Details
What i've done is add a few new items into the config. You'll have to add these yourself if your applying the patch or all hell will break loose.'date_format' => 'm/d/Y', 'time_format' => 'h:i a', 'time_format_seconds' => 'h:i:s a', 'name_date_macro' => '%s (%s)', 'date_macro_format' => 'm/d/Y h:i a',
The format strings are passed into the PHP date() function[link5]. Use the the date() reference[link5] to understand what each character means.
The '
name_date_macro
' isn't directly related to date formats, but it was a simple change. The first %s
is the user name and the second %s
is where the date goes. This little change allows you to change the formatting of this macro.5. Future Implementation
My implementation works well, but could probably use some improvements. It's arguable if these things really belong in$wackoLanguage
and not $config
as it's sort of a localization issue. You could also argue that it's a matter of personal preference and belongs as part of the user settings.Also the change i made for '
name_date_macro
' should be expanded into a more powerful configuration language for wacko macros. Possibly in a way similar to how {{actions}}
work. 6. Discussion
WackoWiki 6.1 implemented the IntlDateFormatter[link6].
- [link1] https://wackowiki.org/bugs/view.php?id=341
- [link2] https://wackowiki.org/bugs/view.php?id=56
- [link3] https://wackowiki.org/doc/WackoWiki
- [link4] http://www.sickheadgames.com/stuff/datetime.patch
- [link5] https://www.php.net/manual/en/function.date.php
- [link6] https://wackowiki.org/doc/Dev/Release/R6.1/IntlDateFormatter