From 94ee8f6e239b20966237664655138828365ea148 Mon Sep 17 00:00:00 2001 From: Vasil Kolev Date: Tue, 20 Oct 2015 10:35:40 +0300 Subject: [PATCH] move the setting of the locale a bit, it's needed only once --- schedule/parse.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/schedule/parse.php b/schedule/parse.php index 894bc85..68fac65 100644 --- a/schedule/parse.php +++ b/schedule/parse.php @@ -28,7 +28,9 @@ $hall_ids = array_keys($data['halls']); $first_hall_id = min($hall_ids); $last_hall_id = max($hall_ids); +/* We need to set these so we actually parse properly the dates. WP fucks up both. */ date_default_timezone_set('Europe/Sofia'); +setlocale(LC_TIME, $languages[$lang]['locale']); foreach ($data['slots'] as $slot_id => $slot) { $slotTime = $slot['starts_at']; @@ -36,7 +38,6 @@ foreach ($data['slots'] as $slot_id => $slot) { if ($slotDate !== $date) { /* this seems to be the easiest way to localize the date */ - setlocale(LC_TIME, $languages[$lang]['locale']); $localdate = strftime('%d %B - %A' ,$slotTime); $lines[] = ''; $lines[] = '' . $localdate . '';