summaryrefslogtreecommitdiffstats
path: root/mdkapplet_gui.pm
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mandriva.org>2010-01-27 17:25:46 +0000
committerThierry Vignaud <tv@mandriva.org>2010-01-27 17:25:46 +0000
commit874b3eb01ebdbc78a8d1e652dd355a941c0283d5 (patch)
tree5fd49ccfa4a2f50302452b3e2646ed68cc89e4c1 /mdkapplet_gui.pm
parent5df65d3184cc59d25abd748c3bd2688d2fd512ca (diff)
downloadmgaonline-874b3eb01ebdbc78a8d1e652dd355a941c0283d5.tar
mgaonline-874b3eb01ebdbc78a8d1e652dd355a941c0283d5.tar.gz
mgaonline-874b3eb01ebdbc78a8d1e652dd355a941c0283d5.tar.bz2
mgaonline-874b3eb01ebdbc78a8d1e652dd355a941c0283d5.tar.xz
mgaonline-874b3eb01ebdbc78a8d1e652dd355a941c0283d5.zip
(iso8601_date_to_locale) share it
Diffstat (limited to 'mdkapplet_gui.pm')
-rw-r--r--mdkapplet_gui.pm14
1 files changed, 13 insertions, 1 deletions
diff --git a/mdkapplet_gui.pm b/mdkapplet_gui.pm
index 9509e969..cc416977 100644
--- a/mdkapplet_gui.pm
+++ b/mdkapplet_gui.pm
@@ -25,7 +25,7 @@ package mdkapplet_gui;
use strict;
use lib qw(/usr/lib/libDrakX);
use common;
-
+use DateTime;
our @ISA = qw(Exporter);
our @EXPORT = qw(
@@ -35,6 +35,7 @@ our @EXPORT = qw(
$localfile
$width
fill_n_run_portable_dialog
+ iso8601_date_to_locale
new_link_button
new_portable_dialog
setVar
@@ -122,3 +123,14 @@ sub setVar {
setVarsInSh($localfile, \%s);
read_local_config();
}
+
+sub iso8601_date_to_locale {
+ my ($date) = @_;
+ return $date if $date !~ /(\d\d\d\d)-?(\d\d)-?(\d\d)/;
+ my $dt = DateTime->new(year => $1, month => $2, day => $3);
+ my $date1 = $dt->strftime("%x");
+ # will fail on some locales (eg: br_FR, ...):
+ eval { $dt->set_locale($ENV{LC_TIME}) };
+ my $date2 = $dt->strftime("%x");
+ $date2 || $date1;
+}