mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-27 17:18:54 +01:00
Fix long date display got the wrong month for some combinations of date format and timezone offset direction.
This commit is contained in:
parent
115f420996
commit
5fa3d455a5
@ -3075,6 +3075,8 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend(
|
|||||||
{
|
{
|
||||||
first = new Date(first);
|
first = new Date(first);
|
||||||
}
|
}
|
||||||
|
var first_format = new Date(first.valueOf() + first.getTimezoneOffset() * 60 * 1000);
|
||||||
|
|
||||||
if(typeof last == 'string' && last)
|
if(typeof last == 'string' && last)
|
||||||
{
|
{
|
||||||
last = new Date(last);
|
last = new Date(last);
|
||||||
@ -3083,6 +3085,10 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend(
|
|||||||
{
|
{
|
||||||
last = false;
|
last = false;
|
||||||
}
|
}
|
||||||
|
if(last)
|
||||||
|
{
|
||||||
|
var last_format = new Date(last.valueOf() + last.getTimezoneOffset() * 60 * 1000);
|
||||||
|
}
|
||||||
|
|
||||||
if(!display_time) display_time = false;
|
if(!display_time) display_time = false;
|
||||||
if(!display_day) display_day = false;
|
if(!display_day) display_day = false;
|
||||||
@ -3097,7 +3103,7 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend(
|
|||||||
|
|
||||||
if (display_day)
|
if (display_day)
|
||||||
{
|
{
|
||||||
range = jQuery.datepicker.formatDate('DD',first)+(datefmt[0] != 'd' ? ' ' : ', ');
|
range = jQuery.datepicker.formatDate('DD',first_format)+(datefmt[0] != 'd' ? ' ' : ', ');
|
||||||
}
|
}
|
||||||
for (var i = 0; i < 5; i += 2)
|
for (var i = 0; i < 5; i += 2)
|
||||||
{
|
{
|
||||||
@ -3105,11 +3111,11 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend(
|
|||||||
{
|
{
|
||||||
case 'd':
|
case 'd':
|
||||||
range += first.getUTCDate()+ (datefmt[1] == '.' ? '.' : '');
|
range += first.getUTCDate()+ (datefmt[1] == '.' ? '.' : '');
|
||||||
if (last && (first.getUTCMonth() != last.getUTCMonth() || first.getFullYear() != last.getFullYear()))
|
if (last && (first.getUTCMonth() != last.getUTCMonth() || first.getUTCFullYear() != last.getUTCFullYear()))
|
||||||
{
|
{
|
||||||
if (!month_before_day)
|
if (!month_before_day)
|
||||||
{
|
{
|
||||||
range += jQuery.datepicker.formatDate('MM',first);
|
range += jQuery.datepicker.formatDate('MM',first_format);
|
||||||
}
|
}
|
||||||
if (first.getFullYear() != last.getFullYear() && datefmt[0] != 'Y')
|
if (first.getFullYear() != last.getFullYear() && datefmt[0] != 'Y')
|
||||||
{
|
{
|
||||||
@ -3117,7 +3123,7 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend(
|
|||||||
}
|
}
|
||||||
if (display_time)
|
if (display_time)
|
||||||
{
|
{
|
||||||
range += ' '+jQuery.datepicker.formatDate(dateTimeFormat(timefmt),first);
|
range += ' '+jQuery.datepicker.formatDate(dateTimeFormat(timefmt),first_format);
|
||||||
}
|
}
|
||||||
if (!last)
|
if (!last)
|
||||||
{
|
{
|
||||||
@ -3127,19 +3133,19 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend(
|
|||||||
|
|
||||||
if (first.getFullYear() != last.getFullYear() && datefmt[0] == 'Y')
|
if (first.getFullYear() != last.getFullYear() && datefmt[0] == 'Y')
|
||||||
{
|
{
|
||||||
range += last.getFullYear() + ', ';
|
range += last.getUTCFullYear() + ', ';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (month_before_day)
|
if (month_before_day)
|
||||||
{
|
{
|
||||||
range += jQuery.datepicker.formatDate('MM',last);
|
range += jQuery.datepicker.formatDate('MM',last_format);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (display_time)
|
if (display_time)
|
||||||
{
|
{
|
||||||
range += ' '+jQuery.datepicker.formatDate(dateTimeFormat(timefmt),last);
|
range += ' '+jQuery.datepicker.formatDate(dateTimeFormat(timefmt),last_format);
|
||||||
}
|
}
|
||||||
if(last)
|
if(last)
|
||||||
{
|
{
|
||||||
@ -3153,23 +3159,23 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend(
|
|||||||
break;
|
break;
|
||||||
case 'm':
|
case 'm':
|
||||||
case 'M':
|
case 'M':
|
||||||
range += ' '+jQuery.datepicker.formatDate('MM',month_before_day ? first : last) + ' ';
|
range += ' '+jQuery.datepicker.formatDate('MM',month_before_day ? first_format : last_format) + ' ';
|
||||||
break;
|
break;
|
||||||
case 'Y':
|
case 'Y':
|
||||||
if (datefmt[0] != 'm')
|
if (datefmt[0] != 'm')
|
||||||
{
|
{
|
||||||
range += ' ' + (datefmt[0] == 'Y' ? first.getFullYear()+(datefmt[2] == 'd' ? ', ' : ' ') : last.getFullYear()+' ');
|
range += ' ' + (datefmt[0] == 'Y' ? first.getUTCFullYear()+(datefmt[2] == 'd' ? ', ' : ' ') : last.getUTCFullYear()+' ');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (display_time && last)
|
if (display_time && last)
|
||||||
{
|
{
|
||||||
range += ' '+jQuery.datepicker.formatDate(dateTimeFormat(timefmt),last);
|
range += ' '+jQuery.datepicker.formatDate(dateTimeFormat(timefmt),last_format);
|
||||||
}
|
}
|
||||||
if (datefmt[4] == 'Y' && datefmt[0] == 'm')
|
if (datefmt[4] == 'Y' && datefmt[0] == 'm')
|
||||||
{
|
{
|
||||||
range += ', ' + last.getFullYear();
|
range += ', ' + last.getUTCFullYear();
|
||||||
}
|
}
|
||||||
return range;
|
return range;
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user