forked from extern/egroupware
fix for bug #700: Date format d-M-Y not working in Infolog list display
This commit is contained in:
parent
2ed91ce075
commit
9748cf96be
@ -164,7 +164,18 @@
|
||||
}
|
||||
if ($value['m'] && strchr($this->dateformat,'M') !== false)
|
||||
{
|
||||
$value['M'] = substr(lang(adodb_date('F',$value['m'])),0,3);
|
||||
static $month = array('','January','February','March','April','Mai','June','July','August','September','October','November','December');
|
||||
static $substr;
|
||||
if (is_null($substr)) $substr = function_exists('mb_substr') ? 'mb_substr' : 'substr';
|
||||
static $chars_shortcut;
|
||||
if (is_null($chars_shortcut)) $chars_shortcut = (int)lang('3 number of chars for month-shortcut'); // < 0 to take the chars from the end
|
||||
|
||||
$value['M'] = lang(substr($month[$value['m']],0,3)); // check if we have a translation of the short-cut
|
||||
if ($substr($value['M'],-1) == '*') // if not generate one by truncating the translation of the long name
|
||||
{
|
||||
$value['M'] = $chars_shortcut > 0 ? $substr(lang($month[$value['m']]),0,$chars_shortcut) :
|
||||
$substr(lang($month[$value['m']]),$chars_shortcut);
|
||||
}
|
||||
}
|
||||
if ($readonly) // is readonly
|
||||
{
|
||||
|
@ -83,10 +83,16 @@ class jscalendar
|
||||
$date = adodb_date($this->dateformat,$ts = adodb_mktime(12,0,0,$month,$day,$year));
|
||||
if (strpos($this->dateformat,'M') !== false)
|
||||
{
|
||||
static $substr;
|
||||
if (is_null($substr)) $substr = function_exists('mb_substr') ? 'mb_substr' : 'substr';
|
||||
static $chars_shortcut;
|
||||
if (is_null($chars_shortcut)) $chars_shortcut = (int)lang('3 number of chars for month-shortcut'); // < 0 to take the chars from the end
|
||||
|
||||
$short = lang(adodb_date('M',$ts)); // check if we have a translation of the short-cut
|
||||
if (substr($short,-1) == '*') // if not generate one by truncating the translation of the long name
|
||||
if ($substr($short,-1) == '*') // if not generate one by truncating the translation of the long name
|
||||
{
|
||||
$short = substr(lang(adodb_date('F',$ts)),0,(int) lang('3 number of chars for month-shortcut'));
|
||||
$short = $chars_shortcut > 0 ? $substr(lang(adodb_date('F',$ts)),0,$chars_shortcut) :
|
||||
$substr(lang(adodb_date('F',$ts)),$chars_shortcut);
|
||||
}
|
||||
$date = str_replace(adodb_date('M',$ts),$short,$date);
|
||||
}
|
||||
|
@ -255,11 +255,13 @@ foreach($day2int as $name => $n)
|
||||
|
||||
Calendar._SDN = new Array
|
||||
(<?php // short day names
|
||||
static $substr;
|
||||
if(is_null($substr)) $substr = function_exists('mb_substr') ? 'mb_substr' : 'substr';
|
||||
$chars_shortcut = (int) lang('3 number of chars for day-shortcut'); // < 0 to take the chars from the end
|
||||
foreach($day2int as $name => $n)
|
||||
{
|
||||
echo "\n \"".($chars_shortcut > 0 ? substr(lang($name),0,$chars_shortcut) :
|
||||
substr(lang($name),$chars_shortcut)).'"'.($n < 6 ? ',' : '');
|
||||
echo "\n \"".($chars_shortcut > 0 ? $substr(lang($name),0,$chars_shortcut) :
|
||||
$substr(lang($name),$chars_shortcut)).'"'.($n < 6 ? ',' : '');
|
||||
}
|
||||
?>);
|
||||
Calendar._SDN_len = <?php echo abs((int) lang('3 number of chars for day-shortcut')); ?>;
|
||||
@ -276,13 +278,13 @@ foreach($monthnames as $n => $name)
|
||||
Calendar._SMN = new Array
|
||||
(<?php // short month names
|
||||
$monthnames = array('January','February','March','April','May','June','July','August','September','October','November','December');
|
||||
$chars_shortcut = (int)lang('3 number of chars for month-shortcut'); // < 0 to take the chars from the end
|
||||
foreach($monthnames as $n => $name)
|
||||
{
|
||||
$short = lang(substr($name,0,3)); // test if our lang-file have a translation for the english short with 3 chars
|
||||
if (substr($short,-1) == '*') // else create one by truncating the full translation to x chars
|
||||
if ($substr($short,-1) == '*') // else create one by truncating the full translation to x chars
|
||||
{
|
||||
$chars_shortcut = (int)lang('3 number of chars for month-shortcut'); // < 0 to take the chars from the end
|
||||
$short = $chars_shortcut > 0 ? substr(lang($name),0,$chars_shortcut) : substr(lang($name),$chars_shortcut);
|
||||
$short = $chars_shortcut > 0 ? $substr(lang($name),0,$chars_shortcut) : $substr(lang($name),$chars_shortcut);
|
||||
}
|
||||
echo "\n \"".$short.'"'.($n < 11 ? ',' : '');
|
||||
}
|
||||
|
@ -61,6 +61,8 @@ Calendar = function (firstDayOfWeek, dateStr, onSelected, onClose) {
|
||||
ar[--i] = Calendar._DN[i].substr(0, Calendar._SDN_len);
|
||||
}
|
||||
Calendar._SDN = ar;
|
||||
}
|
||||
if (typeof Calendar._SMN == "undefined") {
|
||||
// table of short month names
|
||||
if (typeof Calendar._SMN_len == "undefined")
|
||||
Calendar._SMN_len = 3;
|
||||
@ -1438,7 +1440,8 @@ Calendar.prototype.parseDate = function (str, fmt) {
|
||||
var y = 0;
|
||||
var m = -1;
|
||||
var d = 0;
|
||||
var a = str.split(/\W+/);
|
||||
// var a = str.split(/\W+/); does not work with multibyte chars, eg. german umlauts under utf-8
|
||||
var a = str.split(/[./-]/);
|
||||
if (!fmt) {
|
||||
fmt = this.dateFormat;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user