mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-01-27 00:33:34 +00:00
Handle HTTP date formatting for non-english locales (force English names).
This commit is contained in:
parent
a6d6dfc8b8
commit
8d4dfb5d91
@ -334,8 +334,26 @@ function DeconstructURL( $url, $force_script = false ) {
|
||||
* @param string $isodate The date to convert
|
||||
*/
|
||||
function ISODateToHTTPDate( $isodate ) {
|
||||
// It is necessary to use English for this, explicitly. See Debian BTS Bug#661985 for more info.
|
||||
$month = gmstrftime('%m', strtotime($isodate));
|
||||
switch( intval($month) ) {
|
||||
case 1: $month = 'January'; break;
|
||||
case 2: $month = 'February'; break;
|
||||
case 3: $month = 'March'; break;
|
||||
case 4: $month = 'April'; break;
|
||||
case 5: $month = 'May'; break;
|
||||
case 6: $month = 'June'; break;
|
||||
case 7: $month = 'July'; break;
|
||||
case 8: $month = 'August'; break;
|
||||
case 9: $month = 'September'; break;
|
||||
case 10: $month = 'October'; break;
|
||||
case 11: $month = 'November'; break;
|
||||
case 12: $month = 'December'; break;
|
||||
default:
|
||||
throw new Exception('Invalid month '.$month);
|
||||
}
|
||||
// Use strtotime since strptime is not available on Windows platform.
|
||||
return( gmstrftime('%a, %d %b %Y %H:%M:%S GMT', strtotime($isodate)) );
|
||||
return( gmstrftime('%a, '.$month.' %b %Y %H:%M:%S GMT', strtotime($isodate)) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -334,8 +334,26 @@ function DeconstructURL( $url, $force_script = false ) {
|
||||
* @param string $isodate The date to convert
|
||||
*/
|
||||
function ISODateToHTTPDate( $isodate ) {
|
||||
// It is necessary to use English for this, explicitly. See Debian BTS Bug#661985 for more info.
|
||||
$month = gmstrftime('%m', strtotime($isodate));
|
||||
switch( intval($month) ) {
|
||||
case 1: $month = 'January'; break;
|
||||
case 2: $month = 'February'; break;
|
||||
case 3: $month = 'March'; break;
|
||||
case 4: $month = 'April'; break;
|
||||
case 5: $month = 'May'; break;
|
||||
case 6: $month = 'June'; break;
|
||||
case 7: $month = 'July'; break;
|
||||
case 8: $month = 'August'; break;
|
||||
case 9: $month = 'September'; break;
|
||||
case 10: $month = 'October'; break;
|
||||
case 11: $month = 'November'; break;
|
||||
case 12: $month = 'December'; break;
|
||||
default:
|
||||
throw new Exception('Invalid month '.$month);
|
||||
}
|
||||
// Use strtotime since strptime is not available on Windows platform.
|
||||
return( gmstrftime('%a, %d %b %Y %H:%M:%S GMT', strtotime($isodate)) );
|
||||
return( gmstrftime('%a, '.$month.' %b %Y %H:%M:%S GMT', strtotime($isodate)) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user