clear sandbox/test commit
[ikiwiki.git] / IkiWiki / Plugin / date.pm
blobea5c9a9c5dae9e29ef5ca73b6a066c495405f7b9
1 #!/usr/bin/perl
2 package IkiWiki::Plugin::date;
4 use warnings;
5 use strict;
6 use IkiWiki 3.00;
8 sub import {
9 hook(type => "getsetup", id => "date", call => \&getsetup);
10 hook(type => "preprocess", id => "date", call => \&preprocess);
13 sub getsetup () {
14 return
15 plugin => {
16 safe => 1,
17 rebuild => undef,
18 section => "widget",
22 sub preprocess (@) {
23 my $str=shift;
25 eval q{use Date::Parse};
26 error $@ if $@;
27 my $time = str2time($str);
28 if (! defined $time) {
29 error("unable to parse $str");
31 return displaytime($time);