php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66125 IntlCalendar::isWeekend with ar_SA
Submitted: 2013-11-20 09:55 UTC Modified: 2016-04-09 19:23 UTC
From: php at kriegt dot es Assigned:
Status: Not a bug Package: intl (PECL)
PHP Version: 5.5.6 OS: wheezy
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: php at kriegt dot es
New email:
PHP Version: OS:

 

 [2013-11-20 09:55 UTC] php at kriegt dot es
Description:
------------
Hi, I expected some problem with Locale ar_SA (since this was one of the examples on http://www.php.net/manual/fr/intlcalendar.isweekend.php).

I wanted to check since sunday is not a weekend day for Saudi Arabia, which day is. So I started with monday and finished with saturday, everytime I got false.

So actually, I checked on google what days are weekends for Saudi Arabia and I found the following:
http://en.wikipedia.org/wiki/Workweek_and_weekend#Friday.E2.80.93Saturday_weekend

There you can see, that Saudi Arabia should return true on "friday" and "saturday".

Test script:
---------------
<?php
$cal = IntlCalendar::createInstance('Asia/Riyadh', 'ar_SA');
$cal->set(2013,11,22); // friday

var_dump( $cal->isWeekend() );

$cal->set(2013,11,23); // saturday
var_dump( $cal->isWeekend() );

$cal->set(2013,11,24); // sunday
var_dump( $cal->isWeekend() );

Expected result:
----------------
bool(true)
bool(true)
bool(false)

Actual result:
--------------
bool(false)
bool(false)
bool(false)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-11-20 10:07 UTC] php at kriegt dot es
I am using libicu48 and libicu-dev from debian wheezy repository and PECL intl version 3.0.0.
 [2016-04-09 19:23 UTC] ab@php.net
-Status: Open +Status: Not a bug
 [2016-04-09 19:23 UTC] ab@php.net
Hi,

i've repeated your snipped today as follows (the fun thing is that the day of month is the same :))

<?php
$cal = IntlCalendar::createInstance('Asia/Riyadh', 'ar_SA');

$cal->set(2016,4,22); // friday
var_dump( $cal->isWeekend() );

$cal->set(2016,4,23); // saturday
var_dump( $cal->isWeekend() );

$cal->set(2016,4,24); // sunday
var_dump( $cal->isWeekend() );

The output is as follows:

bool(false)
bool(true)
bool(true)

This is produced with ICU 57.1. It still doesn't look correct as it shows not the correct days for the weekend. But, for sure is - it is something coming from ICU. PHP doesn't interpret these data, it just wraps the corresponding ICU functionality and a boolean in this case. Certanly, it needs to be reported mainstream and you should do that, i currently don't see this as an issue in PHP.

Thanks.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 07:01:27 2024 UTC