root/trunk/plagger/lib/Plagger/Plugin/Filter/FloatingDateTime.pm

Revision 258 (checked in by kazeburo, 15 years ago)

added Plagger::Plugin::Filter::FloatingDateTime?

Line 
1 package Plagger::Plugin::Filter::FloatingDateTime;
2 use strict;
3 use base qw( Plagger::Plugin );
4
5 sub register {
6     my($self, $context) = @_;
7     $context->register_hook(
8         $self,
9         'update.entry.fixup' => \&update,
10     );
11     $self->{tz} = $context->conf->{timezone} || 'local';
12 }
13
14 sub update {
15     my($self, $context, $args) = @_;
16     $args->{entry}->date and $args->{entry}->date->time_zone->is_floating and
17         $args->{entry}->date->set_time_zone($self->{tz});
18 }
19
20 1;
21
22 __END__
23
24 =head1 NAME
25
26 Plagger::Plugin::Filter::FloatingDateTime - fix floating timezone
27
28 =head1 SYNOPSIS
29
30     - module: Filter::FloatingDateTime
31
32 =head1 DESCRIPTION
33
34 This plugin fixes a floating timezone.
35
36 =head1 AUTHOR
37
38 Masahiro Nagano
39
40 =head1 SEE ALSO
41
42 L<Plagger>, L<DateTime>
43
44 =cut
45
46
Note: See TracBrowser for help on using the browser.