Merge branch 'timezone-converter' of git://github.com/GlitchMr/zeroclickinfo-goodies
Conflicts: lib/DDG/Goodie/TimezoneConverter.pm t/TimezoneConverter.tmaster
commit
03577c302a
|
@ -6,7 +6,7 @@ use warnings;
|
|||
use DDG::Goodie;
|
||||
use POSIX qw(fmod);
|
||||
|
||||
triggers any => qw(in into);
|
||||
triggers any => qw(in into to);
|
||||
|
||||
zci is_cached => 1;
|
||||
zci answer_type => 'timezone_converter';
|
||||
|
@ -75,6 +75,7 @@ sub to_time(_) {
|
|||
}
|
||||
|
||||
handle query => sub {
|
||||
my $timezone = qr/(\w+(?:\s*[+-]0*[0-9]{1,5}(?::[0-5][0-9])?)?)?/;
|
||||
my (
|
||||
# Time
|
||||
$hour, $minutes, $seconds, $pm,
|
||||
|
@ -102,15 +103,15 @@ handle query => sub {
|
|||
# Spaces between tokens
|
||||
\s* \b
|
||||
# Optional input timezone
|
||||
(\w+ (?: \s* [+-]\d+ (?: : \d\d )? )? )?
|
||||
$timezone
|
||||
# Spaces
|
||||
\s+
|
||||
# in keywords
|
||||
(?: IN (?: TO )? )
|
||||
(?: IN (?: TO )? | TO )
|
||||
# Spaces
|
||||
\s+
|
||||
# Output timezone
|
||||
(\w+ (?: \s* [+-]\d+ (?: : \d\d )? )? )?
|
||||
$timezone
|
||||
\s* \z
|
||||
}x or return;
|
||||
|
||||
|
|
|
@ -10,9 +10,9 @@ zci is_cached => 1;
|
|||
|
||||
ddg_goodie_test(
|
||||
['DDG::Goodie::TimezoneConverter'],
|
||||
'3:14 into GMT' =>
|
||||
'3:14 in GMT' =>
|
||||
test_zci('3:14 (UTC) is 3:14 (GMT).'),
|
||||
'8:10 A.M. AZOST into CAT' =>
|
||||
'8:10 A.M. AZOST to CAT' =>
|
||||
test_zci('8:10 (AZOST, UTC-1) is 11:10 (CAT, UTC+2).'),
|
||||
'1pm EDT into UTC+2' =>
|
||||
test_zci('13:00 (EDT, UTC-4) is 19:00 (UTC+2).'),
|
||||
|
|
Loading…
Reference in New Issue