October 07, 2003

that was easy: japaneseCalendar CFC

as promised on the 5th, a japaneseCalendar CFC based on ICU4J. the Japanese calendar, sometimes called the Japanese Emperor Era calendar, is identical to the Gregorian calendar except for the year and era (which is why it was so easy to turn into a CFC). each emperor's ascension to the throne begins a new era. each new era's years are numbered starting with 1 (the year of ascension). what could be simpler? the "modern" eras:
  • Meiji: January 8, 1868 AD
  • Taisho: July 30, 1912 AD
  • Showa: December 25, 1926 AD
  • Heisei: January 7, 1989 AD (current era)
you can find the testbed here. note i've added a function to determine the day the week starts (for use in some calendaring components i'm working on). it actually depends on your locale. in Thailand & the US, a week starts on sunday. in France, Poland, etc. it starts on monday. the calendar used (as far as ICU4J is concerned) doesn't matter much. i'll update the other non-gregorian calendar CFC after i'm thru with the next two calendars: chinese and astronomical. this CFC should appear on the devnet gallery soon enough.

0 Comments:

Post a Comment

<< Home