Variable hour formats don't add an extra space any longer. Fixes bug #11915.
This commit is contained in:
parent
dac8186244
commit
19a87ea003
5 changed files with 20 additions and 9 deletions
|
|
@ -8,6 +8,7 @@
|
||||||
- fixed #11900: Request Approval for Version Tag Workflow activity can't select --Continue with this workflow
|
- fixed #11900: Request Approval for Version Tag Workflow activity can't select --Continue with this workflow
|
||||||
- fixed #11898: String eval used in Image::Graph
|
- fixed #11898: String eval used in Image::Graph
|
||||||
- fixed #11913: Editing the survey doesn't work
|
- fixed #11913: Editing the survey doesn't work
|
||||||
|
- fixed #11915: Date macro returns hour value w/ leading space
|
||||||
|
|
||||||
7.10.2
|
7.10.2
|
||||||
- fixed #11884: Editing Templates impossible / Code editor not loaded
|
- fixed #11884: Editing Templates impossible / Code editor not loaded
|
||||||
|
|
|
||||||
|
|
@ -325,7 +325,7 @@ sub epochToHuman {
|
||||||
"d" => "d",
|
"d" => "d",
|
||||||
"D" => "_varday_",
|
"D" => "_varday_",
|
||||||
"h" => "I",
|
"h" => "I",
|
||||||
"H" => "l",
|
"H" => "_varhour_",
|
||||||
"j" => "H",
|
"j" => "H",
|
||||||
"J" => "k",
|
"J" => "k",
|
||||||
"m" => "m",
|
"m" => "m",
|
||||||
|
|
@ -351,11 +351,15 @@ sub epochToHuman {
|
||||||
$output = $dt->strftime($output);
|
$output = $dt->strftime($output);
|
||||||
|
|
||||||
#--- %M
|
#--- %M
|
||||||
$temp = int($dt->month);
|
$temp = $dt->month;
|
||||||
$output =~ s/\%_varmonth_/$temp/g;
|
$output =~ s/\%_varmonth_/$temp/g;
|
||||||
#-- %D
|
#-- %D
|
||||||
$temp = int($dt->day);
|
$temp = $dt->day;
|
||||||
$output =~ s/\%_varday_/$temp/g;
|
$output =~ s/\%_varday_/$temp/g;
|
||||||
|
#-- %H, variable digit hour, 12 hour clock
|
||||||
|
$temp = $dt->hour;
|
||||||
|
$temp -= 12 if ($temp > 12);
|
||||||
|
$output =~ s/\%_varhour_/$temp/g;
|
||||||
#--- return
|
#--- return
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -130,7 +130,7 @@ is(
|
||||||
);
|
);
|
||||||
|
|
||||||
$date2 = WebGUI::Form::DateTime->new($session, {defaultValue => -1});
|
$date2 = WebGUI::Form::DateTime->new($session, {defaultValue => -1});
|
||||||
is($date2->getValueAsHtml(), '12/31/1969 5:59 pm', "getValueAsHtml: defaultValue as negative epoch, returns as user's format");
|
is($date2->getValueAsHtml(), '12/31/1969 5:59 pm', "getValueAsHtml: defaultValue as negative epoch, returns as user's format");
|
||||||
is(
|
is(
|
||||||
getValueFromForm($session, $date2->toHtmlAsHidden),
|
getValueFromForm($session, $date2->toHtmlAsHidden),
|
||||||
'1969-12-31 17:59:59',
|
'1969-12-31 17:59:59',
|
||||||
|
|
@ -158,7 +158,7 @@ is(
|
||||||
|
|
||||||
|
|
||||||
$date2 = WebGUI::Form::DateTime->new($session, {defaultValue => '2008-08-01 11:34:26', value => $bday, });
|
$date2 = WebGUI::Form::DateTime->new($session, {defaultValue => '2008-08-01 11:34:26', value => $bday, });
|
||||||
is($date2->getValueAsHtml(), '8/16/2001 8:00 am', "getValueAsHtml: defaultValue in mysql format, value as epoch returns value in user's format");
|
is($date2->getValueAsHtml(), '8/16/2001 8:00 am', "getValueAsHtml: defaultValue in mysql format, value as epoch returns value in user's format");
|
||||||
is(
|
is(
|
||||||
getValueFromForm($session, $date2->toHtmlAsHidden),
|
getValueFromForm($session, $date2->toHtmlAsHidden),
|
||||||
'2001-08-16 08:00:00',
|
'2001-08-16 08:00:00',
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ my @testSets = (
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
format => '',
|
format => '',
|
||||||
output =>'8/16/2001 8:00 am',
|
output =>'8/16/2001 8:00 am',
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -61,7 +61,7 @@ is($output, $session->datetime->epochToHuman($time1), 'checking default time and
|
||||||
|
|
||||||
##Checking for edge case, time=0
|
##Checking for edge case, time=0
|
||||||
is WebGUI::Macro::D_date::process($session, '', 0),
|
is WebGUI::Macro::D_date::process($session, '', 0),
|
||||||
'12/31/1969 6:00 pm',
|
'12/31/1969 6:00 pm',
|
||||||
'...checking for handling time=0';
|
'...checking for handling time=0';
|
||||||
|
|
||||||
lives_ok { WebGUI::Macro::D_date::process($session, '', ' 0') }
|
lives_ok { WebGUI::Macro::D_date::process($session, '', ' 0') }
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ use File::Spec;
|
||||||
use WebGUI::Test;
|
use WebGUI::Test;
|
||||||
use WebGUI::Session;
|
use WebGUI::Session;
|
||||||
|
|
||||||
use Test::More tests => 92; # increment this value for each test you create
|
use Test::More tests => 95; # increment this value for each test you create
|
||||||
|
|
||||||
installBadLocale();
|
installBadLocale();
|
||||||
WebGUI::Test->addToCleanup(sub { unlink File::Spec->catfile(WebGUI::Test->lib, qw/WebGUI i18n BadLocale.pm/); });
|
WebGUI::Test->addToCleanup(sub { unlink File::Spec->catfile(WebGUI::Test->lib, qw/WebGUI i18n BadLocale.pm/); });
|
||||||
|
|
@ -298,9 +298,15 @@ cmp_ok(
|
||||||
|
|
||||||
$dude->profileField('language', 'BadLocale');
|
$dude->profileField('language', 'BadLocale');
|
||||||
$session->user({user => $dude});
|
$session->user({user => $dude});
|
||||||
is($dt->epochToHuman($wgbday), '8/16/2001 9:00 pm', 'epochToHuman: constructs a default locale if the language does not provide one.');
|
is($dt->epochToHuman($wgbday), '8/16/2001 9:00 pm', 'epochToHuman: constructs a default locale if the language does not provide one.');
|
||||||
$session->user({userId => 1});
|
$session->user({userId => 1});
|
||||||
|
|
||||||
|
##Variable digit days, months and hours
|
||||||
|
is($dt->epochToHuman($wgbday,'%M'), '8', '... single digit month');
|
||||||
|
my $dayEpoch = DateTime->from_epoch(epoch => $wgbday)->subtract(days => 10)->epoch;
|
||||||
|
is($dt->epochToHuman($dayEpoch,'%D'), '6', '... single digit day');
|
||||||
|
is($dt->epochToHuman($dayEpoch,'%H'), '8', '... single digit hour');
|
||||||
|
|
||||||
sub installBadLocale {
|
sub installBadLocale {
|
||||||
copy(
|
copy(
|
||||||
WebGUI::Test->getTestCollateralPath('BadLocale.pm'),
|
WebGUI::Test->getTestCollateralPath('BadLocale.pm'),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue