manage better meridiem cases with datetimepicker (use strpos) (#116)

This commit is contained in:
FrancescoUK committed 2016-02-19 19:07:39 +00:00
1 parent ab87b30423
commit cf92544600
2 files changed
+48 -40

No files matched your search

+24 -20
View File
@@ -159,20 +159,24 @@ $(document).ready(function()
"<?php echo $this->lang->line("common_monthsshort_december"); ?>"],
today: "<?php echo $this->lang->line("common_today"); ?>",
<?php
$t = $this->config->item('timeformat');
$m = $t[strlen($t)-1];
if( $m == 'a')
{
if( strpos($this->config->item('timeformat'), 'a') !== false )
{
?>
meridiem: ["am", "pm"],
meridiem: ["am", "pm"],
<?php
}
else
{
}
else if( strpos($this->config->item('timeformat'), 'A') !== false )
{
?>
meridiem: ["AM", "PM"],
meridiem: ["AM", "PM"],
<?php
}
}
else
{
?>
meridiem: [],
<?php
}
?>
weekStart: <?php echo $this->lang->line("common_weekstart"); ?>,
};
@@ -181,20 +185,20 @@ $(document).ready(function()
format: "<?php echo dateformat_bootstrap($this->config->item("dateformat")) . ' ' . dateformat_bootstrap($this->config->item("timeformat"));?>",
startDate: "<?php echo date($this->config->item('dateformat') . ' ' . $this->config->item('timeformat'), mktime(0, 0, 0, 1, 1, 2010));?>",
<?php
$t = $this->config->item('timeformat');
$m = $t[strlen($t)-1];
if( $m == 'a' || $m == 'A' )
{
$t = $this->config->item('timeformat');
$m = $t[strlen($t)-1];
if( strpos($this->config->item('timeformat'), 'a') !== false || strpos($this->config->item('timeformat'), 'A') !== false )
{
?>
showMeridian: true,
showMeridian: true,
<?php
}
else
{
}
else
{
?>
showMeridian: false,
showMeridian: false,
<?php
}
}
?>
minuteStep: 1,
autoclose: true,
+24 -20
View File
@@ -102,20 +102,24 @@ $(document).ready(function()
"<?php echo $this->lang->line("common_monthsshort_december"); ?>"],
today: "<?php echo $this->lang->line("common_today"); ?>",
<?php
$t = $this->config->item('timeformat');
$m = $t[strlen($t)-1];
if( $m == 'a')
{
if( strpos($this->config->item('timeformat'), 'a') !== false )
{
?>
meridiem: ["am", "pm"],
meridiem: ["am", "pm"],
<?php
}
else
{
}
else if( strpos($this->config->item('timeformat'), 'A') !== false )
{
?>
meridiem: ["AM", "PM"],
meridiem: ["AM", "PM"],
<?php
}
}
else
{
?>
meridiem: [],
<?php
}
?>
weekStart: <?php echo $this->lang->line("common_weekstart"); ?>
};
@@ -125,20 +129,20 @@ $(document).ready(function()
format: "<?php echo dateformat_bootstrap($this->config->item("dateformat")) . ' ' . dateformat_bootstrap($this->config->item("timeformat"));?>",
startDate: "<?php echo date($this->config->item('dateformat') . ' ' . $this->config->item('timeformat'), mktime(0, 0, 0, 1, 1, 2010));?>",
<?php
$t = $this->config->item('timeformat');
$m = $t[strlen($t)-1];
if( $m == 'a' || $m == 'A' )
{
$t = $this->config->item('timeformat');
$m = $t[strlen($t)-1];
if( strpos($this->config->item('timeformat'), 'a') !== false || strpos($this->config->item('timeformat'), 'A') !== false )
{
?>
showMeridian: true,
showMeridian: true,
<?php
}
else
{
}
else
{
?>
showMeridian: false,
showMeridian: false,
<?php
}
}
?>
autoclose: true,
todayBtn: true,