| 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} = $self->conf->{timezone} || $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__ |