Added by Thomas Weidner, last edited by Thomas Weidner on Dec 26, 2006  (view change)

Labels

 
(None)

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
Gavin (Zend-liaison)
Revision 0.9 - 21 September 2006: Extension for Zend_Date. (wiki revision: 6)

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

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

Posted by Gavin at Dec 27, 2006 14:10

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...

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.

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

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.

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

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.

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.

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

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

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

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...

View the rest of this thread. Most recent comment: Feb 28, 2008
2 more comments by: Ziyad Saeed, Thomas Weidner

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.

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

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

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.