Issues

ZF-5259: CLONE -setweekday() parameters rule does not same as display rule

Description

Zend_Date to array or display the Weekday, always consider the Sunday is '0', but setweekday() consider Sunday is '7'.

would that can be the same rule ?

Comments

I mean the setWeekDay follows the ISO standard, so sunday is '7'. But if use toArray() of Zend_Date, the weekday will be '0' as the GNU standard.

I suggest that use one rule for Zend_Date, not two different kind of rule. It will make people confused.

Why would this be a problem when both rules are supported ?

It is not consistent.

Please consider below situation:

$a->setWeekDay(7);

$b = $a->toArray(); $weekDay = $b['weekday'];

echo $weekDay (It is 0, not 7)


But if it is consistent. Then we can define a constant to check it.

define('SUNDAY', 0); ( Or 7 if ISO standard)

$a->setWeekDay(SUNDAY); $b = $a->toArray(); $weekDay = $b['weekday'];

echo $weekDay==SUNDAY (This will be true, because it is consistent)

Integrated with r13258