yohang / CalendR

The missing PHP 5.3+ calendar management library.
http:/yohan.giarel.li/CalendR
MIT License
465 stars 65 forks source link

set first weekday #19

Closed dragosperca closed 11 years ago

dragosperca commented 11 years ago

When calling $factory->setFirstWeekday() depending on current month first day, the class can generate an error.

For example, trying to set first week day as Thursday on May 2013, via: $factory->setFirstWeekday(4)

generates this: Fatal error: Uncaught exception 'Exception' with message 'DateInterval::__construct() [dateinterval.--construct]: Unknown or bad format (P-1D)' in ../vendor/yohang/calendr/src/CalendR/Period/Month.php:84

dragosperca commented 11 years ago

Even with a more 'normal', Sunday/Monday start, for September 2013, the class generates an empty week (see printscreen below) which suggests Month.php class should be changed a little.

sept_2013_calendr

yohang commented 11 years ago

@dragosperca Hi, could you open an other issue for second case ?

yohang commented 11 years ago

Fixed.

dragosperca commented 11 years ago

both patches seem to work great, thank you! Do you know when this change will be visible within Composer/Packagist?

yohang commented 11 years ago

I'll tag a new release, it should be available in minutes.