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

Revision 1761 (checked in by miyagawa, 14 years ago)

add Filter::ForceTimeZone?

Line 
1 package Plagger::Plugin::Filter::ForceTimeZone;
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} = $self->conf->{timezone} || $context->conf->{timezone} || 'local';
12 }
13
14 sub update {
15     my($self, $context, $args) = @_;
16     $args->{entry}->date and
17         $args->{entry}->date->set_time_zone($self->{tz});
18 }
19
20 1;
21 __END__
22
23 =head1 NAME
24
25 Plagger::Plugin::Filter::ForceTimeZone - Force set Timezone regardless of it's UTC or floating
26
27 =head1 SYNOPSIS
28
29   - module: Filter::ForceTimeZone
30
31 =head1 DESCRIPTION
32
33 This plugin force fixes timezone of entries datetime to that of
34 Plagger global timezone. While Filter::FloatingDateTime only fixed
35 timezone when datetime is floating, this plugin changes all datetime
36 TZ regardless of it's UTC or floating.
37
38 If global timezone is not set, this module tries to use system local
39 timezone.
40
41 =head1 AUTHOR
42
43 Tatsuhiko Miyagawa
44
45 =head1 SEE ALSO
46
47 L<Plagger>, L<Plagger::Plugin::Filter::FloatingDateTime>
48
49 =cut
Note: See TracBrowser for help on using the browser.