<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/usr/bin/perl
package IkiWiki::Plugin::date;

use warnings;
use strict;
use IkiWiki 3.00;

sub import {
	hook(type =&gt; "getsetup", id =&gt; "date", call =&gt; \&amp;getsetup);
	hook(type =&gt; "preprocess", id =&gt; "date", call =&gt; \&amp;preprocess);
}

sub getsetup () {
	return
		plugin =&gt; {
			safe =&gt; 1,
			rebuild =&gt; undef,
			section =&gt; "widget",
		},
}

sub preprocess (@) {
	my $str=shift;

	eval q{use Date::Parse};
	error $@ if $@;
	my $time = str2time($str);
	if (! defined $time) {
		error("unable to parse $str");
	}
	return displaytime($time);
}

1
</pre></body></html>