Discussion about the date and time-format (not) used in wikka
Date formatting
Hi folks,trying to figure out how to change the date format displayed in Page History and Revisions to something more functional than the "Romance Daylight Time" I get in my wikka installation. Could someone point me in the right direction please? Thanks for a really good wiki btw!
--EgilHelland
In handlers/page/revisions.php replace
$output .= "<td> <a href=\"".$this->Href("show","","time=").urlencode($page["time"])."\">".$page["time"]."</a></td>";
with something like
$output .= "<td> <a href=\"".$this->Href("show","","time=").urlencode($page["time"])."\">".date("l dS of F Y h:i:s A",strtotime($page["time"]))."</a></td>";
in handlers/page/history.php replace
$output .= "<strong>Edited on <a href=\"".$this->Href("", "", "time=".urlencode($pageA["time"]))."\">".$pageA["time"]."</a> by ".$EditedByUser."</strong> <span style=\"color:#888;font-size:smaller;\">".$note."</span><br />\n";
with something like
$output .= "<strong>Edited on <a href=\"".$this->Href("", "", "time=".urlencode($pageA["time"]))."\">".date("l dS of F Y h:i:s A",strtotime($pageA["time"]))."</a> by ".$EditedByUser."</strong> <span style=\"color:#888;font-size:smaller;\">".$note."</span><br />\n";
See php documentation for details on the date() function.
I think it would be nice to add a function for this to the wikka-class and call it everywhere, where times are printed out - would make such things a bit easier (especially if there would be a $DefaultTimeFormat in the config-array).
--TimoK
- Related to this topic: UserSettingsPanel --NilsLindenberg
- As I've mentioned before, what I think we really need is a setting in the configuration for date (and time) format which should then be used everywhere - we're really inconsistent now with every bit of code doing its own date/time formatting. The default for the configuration should then be the standard ISO format since it's non-ambiguous. --JavaWoman
Standard date and time format
Although I'm all for using the ISO date/time format as we see in the timestamp of the footer of every page, I note that several other parts of Wikka use different date/time formats. I'd like to see an approach where this is standardized.Proposal:
- Define date-time format (or separately date and time, as well as a way to combine them) in the configuration; use the ISO format as a default (in the initial configuration, as well as when no format is defined in the config).
- Use this format wherever date and/or time are formatted.
- Make using the configured formats a requirement for every Wikka extension (that displays date/time information) to be included with the distribution.
I realize that in principle it's possible to pick up formats from a locale but for a Wikka targeted at an international audience this may not be the best approach, and for a Wikka with a "local" audience it may not be either if it's hosted on a (public) server outside that country - hence the idea to define a format in the configuration.
--JavaWoman
- Agreed -- DarTar
CategoryDevelopmentFormatters