On Tue, 1 Apr 2003, Daisuke Maki wrote: > I've hacked together DT::Calendar::Japanese and DT::Format::Japanese. Is > there anybody on this list that can use Japanese on his machine?
I somehow got emacs to do so, yes. If it's working and displaying the right characters, then my pathetic character reading skills tell me that the era beginning "857 2 21" was the "heaven peace" era, or something along those lines. > Pls let me know if I did anything glaringly wrong. Well, what you made works, but I think it's somewhat missing the point. Your module simply takes a Gregorian date and then calculates the corresponding Japanese era for that Gregorian date. But your object does not actually represent the Japanese calendar. What I'm getting at is that given a DateTime::Calendar::Japanese object, I'd expect a method like ->year to return the year as it is numbered in the _Japanese_ calendar, not in the Gregorian calendar! If I want to know the corresponding Gregorian year, I can always use DateTime->from_object to produce the equivalent Gregorian object. If you take a look at DT::Calendar::Julian, you'll see that if you call ->year, you are getting the Julian year, not the corresponding Gregorian year. The same goes for all of its other methods. This is how the DT::Calendar::Japanese class should work. In addition, you'll also want methods like ->era, ->regime, possibly ->kigen, and methods to return the major and minor solar terms. If you do want to do this, let's collaborate, because I want to create DateTime::Calendar::Chinese, and they share a lot of core calculations. We might be able to put these in some sort of DateTime::Algorithm::ChineseJapanese module that we could both include as a prereq. -dave /*======================= House Absolute Consulting www.houseabsolute.com =======================*/