I propose a component for time related problems, which I'd like to implement as my pet project. Many of the ideas are taken from Project Joda[1], with "J" as in Java.
The first stage should include only two classes. Both classes are serializable, thus can be stored in sessions. ezcDateTime ----------- Methods ~~~~~~~ isAfter isAfterNow isBefore isBeforeNow ezcDateTimeInterval ------------------- Properties ~~~~~~~~~~ start (ezcDateTime) end (ezcDateTime) Methods ~~~~~~~ __construct( ezcDateTime $start, ezcDateTime $end ) getDurationInSec() overlaps( ezcDateTimeInterval ) contains( ezcDateTimeInterval ) containsNow() Those two classes are not complicate at all, but are really handy and fun to use once you have them and especially if work with booking data as we do. There are many more good ideas at the joda project that can be included in stage 2, e.g. Partial: Times that are not fully defined, e.g. dates without daytime. Stage 3 could be a more complicated project: Recurrance[2]. Handling those devil calendar items that should repeat every second monday in the month at 11o'clock. Some times I worry how many things are in Java that are not in PHP... [1] http://joda-time.sourceforge.net/index.html [2] http://code.google.com/p/google-rfc-2445/ -- Components mailing list [email protected] http://lists.ez.no/mailman/listinfo/components
