isaacgrant/swat — pull request #1 by isaacgrant (2014-01-28 18:53:53+00:00)
Title: More flexible SwatDate::getIntervalFromSeconds()

Plus new connivence methods using it.

Prior to this SwatDate::getIntervalFromSeconds() always returned a fixed interval spec. It
now is flexible, and also adds support for weeks as an interval part. Along with this
flexible support I've added new convience methods
SwatDate::getHumanReadableDateDiffWithWeeks() and
SwatDate::getHumanReadableDateDiffWithWeeksAndDays() which return weeks instead of months,
and for the second method, treat weeks and days as one part.

SwatString also sees related new convience methods using the new
SwatDate::getIntervalFromSeconds() method, and refactoring to prevent code duplication.

SwatString::toHumanReadableTimePeriod() is broken up into three methods:
1. getHumanReadableTimePeriodParts() to generate the array of human readable date parts.
2. toHumanReadableTimePeriodString() to combine that array together, and optional only keep the largest part.
3. toHumanReadableTimePeriod() which uses the above methods to return a basic string.

Along with that restructuring the convience methods
SwatString::toHumanReadableTimePeriodWithWeeks() and
SwatString::toHumanReadableTimePeriodWithWeeksAndDays() have been added to work in
conjuncture with the new SwatDate convience methods.