diff options
author | Jonas Smedegaard <dr@jones.dk> | 2024-08-31 12:24:59 +0200 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2024-09-01 09:18:49 +0200 |
commit | 0f9cda3eb8afd89a9a2470d9a4c19a5c1c69b092 (patch) | |
tree | b1526d09e39a1d12fbd7b25bd0483f458a51fe05 /lib/Object/Groupware.pm | |
parent | 30e1a34d6f69f514c6c1c908c0f77a651074a175 (diff) |
streamline locale and timezone handling
Diffstat (limited to 'lib/Object/Groupware.pm')
-rw-r--r-- | lib/Object/Groupware.pm | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/lib/Object/Groupware.pm b/lib/Object/Groupware.pm new file mode 100644 index 0000000..083f415 --- /dev/null +++ b/lib/Object/Groupware.pm @@ -0,0 +1,37 @@ +use v5.36; +use Feature::Compat::Class 0.07; + +package Object::Groupware 0.01; + +class Object::Groupware; + +use utf8; + +use Log::Any qw( ); + +field $log = Log::Any->get_logger; + +field $dt_locale : param : reader = undef; +field $dt_time_zone : param : reader = undef; +field $dt_span_time_prefix : param : reader = ''; + +ADJUST { + if ( defined $self->dt_locale ) { + $dt_locale = DateTime::Locale->load( $self->dt_locale ) + unless $self->dt_locale isa DateTime::Locale::FromData; + $log->debugf( + 'Class %s set up to use locale %s (%s)', + __CLASS__, $self->dt_locale->code, $self->dt_locale->name + ); + } + if ( defined $self->dt_time_zone ) { + $dt_time_zone = DateTime::TimeZone->new( name => $self->dt_time_zone ) + unless $self->dt_time_zone isa DateTime::TimeZone; + $log->debugf( + 'Class %s set up to use time zone %s', + __CLASS__, $self->dt_time_zone->name + ); + } +} + +1; |