Skip to end of metadata
Go to start of metadata

Zend Framework: Zend_Calendar Component Proposal

Proposed Component Name Zend_Calendar
Developer Notes http://framework.zend.com/wiki/display/ZFDEV/Zend_Calendar
Proposers Thomas Weidner
Revision 0.9 - 21 September 2006: Extension for Zend_Date. (wiki revision: 8)

Table of Contents

1. Overview

Zend_Calendar is an extension class for Zend_Date.
It handles calendar formats different from gregorian calendar.

2. References

3. Component Requirements, Constraints, and Acceptance Criteria

  • Simple API
  • Same handling as Zend_Date to increase useability
  • Locale aware
  • Conversion between different Calendar Formats

4. Dependencies on Other Framework Components

5. Theory of Operation

Zend_Calendar will extend Zend_Date to work also with other calendar formats than the gregorian ones.
It will have an adaptor interface to convert between the different formats.

6. Milestones / Tasks

  • [IN PROGRESS] Acceptance of Proposal
  • Code Basic Class with Adaptor Interface
  • Code Arabic Adaptor
  • Write unit tests
  • Write Docu
  • Code Chinese Adaptor
  • Code Hebrew Adaptor
  • Code Indian Adaptor
  • Code Julian Adaptor
  • Code Persian Adaptor
  • Code Bahai Adaptor
  • Code French Adaptor

7. Class Index

  • Zend_Calendar
  • Zend_Calendar_Exception
  • Zend_Calendar_Arabic
  • Zend_Calendar_Chinese
  • Zend_Calendar_Hebrew
  • Zend_Calendar_Julian
  • Zend_Calendar_xxxxx (other calendar formats as written in milestones)

8. Use Cases

Define a arabic date, convert to gregorian

Work with Calendars

Work with Calendars

9. Class Skeletons

Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Dec 27, 2006

    Public domain JavaScript converters for numerous calendars: http://www.fourmilab.ch/documents/calendar/

    1. Dec 28, 2006

      There are numerous online pages out there which do the same...
      The question is: Is this a reason for us not to support other calendar formats with the benefit of Zend_Date ???

      Zend_Calendar could for example also be used for monthly calendar page creation with an iterator interface implemented.

      And also to mention... there are people out there in the WWW which disable javascript because of security reasons...

      1. Aug 10, 2007

        And you forgot the main reason: To make a easy way of different calendars on ZF. Who cares about JS converters?! I'm doing my application using ZF and I simply don't want to depend of any other solution.

  2. Jan 18, 2008

    There are two type of Calendars in Muslim countries:

    • Arabic Calendar (a.k.a, Islamic Calendar)
    • Iranian Calendar (a.k.a., Persian Calendar or Jalali Calendar).

    In Iran, we use Iranian Calendar which is completely different from
    Arabic calendar.

    For example, Jan 1 2008 equals to:

    • Iranian/Persian Calendar: Month=Dey, Day=11, Year = 1386
    • Arabic Calendar: Month=Dhu al-Hijjah, Day=21, Year = 1428

    Now two requests:
    Please add "class Zend_Calendar_Iranian {} ".
    Please and correct the current Use Cases (1385 Dey 05 is an Iranian Date, not Arabic.)

    @see: http://en.wikipedia.org/wiki/Islamic_calendar
    @see: http://en.wikipedia.org/wiki/Iranian_calendar

    1. Jan 19, 2008

      This are only example-calendars...

      In fact we will support

      • Buddhist Calendar
      • Chinese Calendar
      • Coptic Calendar
      • Ethiopic Calendar
      • Gregorian Calendar
      • Hebrew Calendar
      • Islamic Calendar
      • Islamic Civil Calendar
      • Japanese Calendar
      • Persian Calendar

      These are the calendar formats where we have support informations from unicode.
      But as I have had no time to finish this proposal it will still take some time to be implemented.
      Other things like Zend_File_Upload and improvements to Zend_Translate have more priority than this proposal. But it will not be forgotten... development will just take more time.

  3. Feb 22, 2008

    will this be part of the Zend_Calendar features.
    "Give me date of last Sunday of year 2008" or" What's the date of second Monday for Jan 2007"

    is there a proposal for repeat events
    What about weekly and daily views

    1. Feb 23, 2008

      There is actually no way to recognise "give me date of last Sunday of year 2008" or a silimar string in any known language.

      But you can do this already with the standard Zend_Date API in an equivalent way by simple date calculation.

      Related to your second and third comment:
      This proposal shall make it possible to use different calendar formats than gregorian with Zend_Date. So you can use an islamic date for example.
      It is not intended to create a calendar view. Here you would need a view-helper for example.
      And it is not intended to be used as event handler.

      If you see benefit for a feature you can add a comment showing how the api could look like and what the benefit and usecase would be. I am open to all ideas when they fit.

      1. Feb 27, 2008

        oh i wasn't asking for a natural language interpreter, just that if i want to know whats the date of last sunday of the month jan 2008, will it be able to give me a date

        I'm interested in a proposal that i can use to generate full calendar. it doesn't have to generate the views, but give me something that i can use to generate the views. for eg, If i want to show week 3 to 6 in a calendar view, This proposal should give me the date and day of week 3 to 6. If i ask it show me 3 months from Febuary to march for year 2008, it should give me the date and dates for that. or give me dates for next 7 days starting Feb 26 2008.

        I guess I'm interested in an events calendar, not just a calendar converter to different localizations.

        if you plan to move this into the event type calendar, then i can give you lot of usecases and apis examples.

        1. Feb 27, 2008

          You should take a look at the API of Zend_Date... several things you mentioned here are already possible with just a few single lines.

          For example to get 3 montags from feb 2008 as mentioned with a calendarlike output you can do:

          Anyhow... this will not be a event calendar proposal... a event calendar has to handle dates, events, create views, act on user input and so on...

          This proposal is an extension of Zend_Date for all people which are not using gregorian calendars. Nothing more, nothing less

          1. Feb 27, 2008

            mistyped... $date should of course be $from...

      2. Feb 27, 2008

        How about we design this this so someone else can extend this and make it into an events calendar. that would be great.

        1. Feb 27, 2008

          All what is needed is already here...
          Why should I create the half of something which itself if useless when so someone else can do the second half to have a working complete component ?

          I have really enough to do in my sparetime with existing proposals and feature enhancements. And as all contributors I am only working on things which make sense for ourself. Actually I have no use for a event component. This may change in future but not in short term. Anyone is free to create such a component for himself.

          But I doesn't see any pro for creating a component which needs 3 lines instead of using existing things only to save 2 lines. There is really enough other work to do...

          My 2 cents...

          1. Feb 28, 2008

            what are you going on about
            I never said make one useless half and have someone else do the other half.

            I'm asking the design to me EXTENSIBLE. it doesn't mean you have to do a half baked job. or it has to be incomplete in any way. You can make a complete calendar (with whatever you want) but it would be designed so later on someone else can come along and extend it like Zend_calendar_Event. Design the api by keeping future improvements in mind. How is that bad is beyond me.

            you mentioned a very important point, about doing "what makes sense to you". So its essentially your project. I didn't know that. thanks for clarifying.

            1. Feb 28, 2008

              Every contributor does what makes sense to him... otherwise he would not have created a proposal.

              I would never create a Service proposal because I have no use of services. And if someone is in need of a event component he is free to create a proposal and add this component to ZF.

              Myself is not in need of such a event component... so why should I spend my sparetime for creating something which I do not see benefit for me ?
              And no, ZF is not my project... you may have mentioned that it is open source and several 100s of developers are working on it.
              Just look at the names beside the proposals.

    2. Feb 23, 2008

      What I forgot to mention:
      This proposal is not dead. I had just other priorities like the new Zend_File_Transfer class and several other improvements and until now there were not many people wanting this integrated. So it has just low priority on my work-list.

      1. Aug 11, 2008

        We hope that isn't dead , I really like to see this library on next 2.0 release or maybe in a mini-release .

        1. Aug 11, 2008

          Wether dead nor forgotten.

          But there is much other work beside like the file transfer component.
          It's always a matter of priority... the comunity decided for the other component

  4. Aug 18, 2008

    When I read of Zend_Calendar I thought of a component capable of handling calendars, something that given some options can generate a calendar (in terms of a table with the calendar of the specified month and year).

    If Zend_Calendar is a mere extension of Zend_Date for handling calendars that differs from the gregorian one, why don't just enhance Zend_Date to handle different calendars instead of creating confusion with this namespace?

    Think of a programmer who wants to implement a calendar in his application, don't you think he will try to use the Zend_Calendar namespaces' classes to make a calendar? A Zend_Calendar that handle different calendars - in terms of calendar types - will likely confuse him.

    I hope I explained my point.

  5. Sep 26, 2008

    Hi, Thomas!

    In my point of view, we have two kinds of calendar.
    One calendar is an object that handles events.
    Of course, this calendar should be aware of locale and should have adapters to convert calendars to the right locale.
    The other calendar, is the calendar related to dates.
    If you want to just extend functionality from Zend_Date, you should keep it locally and create the adapters as Zend_Date_Adapter_Interface to have the conversions of the date specifically and not of the events calendar, that is a set of years, months, days, hours, minutes and seconds. Or simply creating it as Zend_Date_Calendar instead of Zend_Calendar.
    Another thing is instead of having methods called toGregorian(), toIslamic(), etc, it should implement a factory method and the calendar to be converted to should be passed as parameter, like:

    In the Zend_Calendar, we could use all the features of the Zend_Date, but with other perspective, and also use the Zend_Date adapters to have the correct view for the calendar also. In the Zend_Calendar, I also think it would be nice to be possible to set working days, working hours, first day in the calendar, adding holidays, events, shifts and display the calendar according to all this settings.

    The Zend_Calendar interface should look like this:

    These set of classes below would be supposed to handle with events:
    Zend_Calendar -> it wouldn't extend Zend_Date
    Zend_Calendar_Year // year object is a set of months
    Zend_Calendar_Month // month object is a set of weeks
    Zend_Calendar_Week // week object is a set of days
    Zend_Calendar_Day // day object is a set of events that will occur at a specifically time in that day
    Zend_Calendar_Event
    Zend_Calendar_Exception
    Zend_Calendar_Adapter // In the case of this calendar, the adapter will work as view translators, translating the calendar objects to its properly locale
    Zend_Calendar_Interface
    Zend_Calendar_Adapter_Arabic
    Zend_Calendar_Adapter_Buddhist
    Zend_Calendar_Adapter_Chinese
    Zend_Calendar_Adapter_Coptic
    Zend_Calendar_Adapter_Ethiopic
    Zend_Calendar_Adapter_Gregorian
    Zend_Calendar_Adapter_Hebrew
    Zend_Calendar_Adapter_Islamic
    Zend_Calendar_Adapter_IslamicCivil
    Zend_Calendar_Adapter_Japanese
    Zend_Calendar_Adapter_Persian
    Zend_Calendar_Adapter_Interface
    Zend_Calendar_Adapter_Exception

    That's my opinion!

    Regards,


    Ramses Paiva
    Software Consultant
    SourceBits Technologies
    www.sourcebits.com

  6. Sep 26, 2008

    Better idea:

    And the components would be only:
    Zend_Calendar -> it wouldn't extend Zend_Date
    Zend_Calendar_Year // year object is a set of months
    Zend_Calendar_Month // month object is a set of weeks
    Zend_Calendar_Week // week object is a set of days
    Zend_Calendar_Day // day object is a set of events that will occur at a specifically time in that day
    Zend_Calendar_Event
    Zend_Calendar_Exception
    Zend_Calendar_Interface

    And the adapters would have a different approach:
    Zend_Calendar_Adapter -> instead of conversion of dates, it could be used as a database connection to retrieve events (and holidays, once the holidays is a specialization of events)
    Zend_Calendar_Adapter_Interface
    Zend_Calendar_Adapter_Exception
    Zend_Calendar_Adapter_DbTable

    Regards,

    -
    Ramses Paiva
    Software Consultant
    SourceBits Technologies
    www.sourcebits.com

  7. Oct 28, 2008

    This proposal requires some refactoring and Thomas currently does not have the time to do it. This will be archived for resurrection later.