Re: DateTime-season?

2008-03-25 Thread David E. Wheeler
On Jan 29, 2008, at 03:19, Zefram wrote: David E. Wheeler wrote: return $date lt '03-21' ? 'winter' : $date lt '06-21' ? 'spring' Northern hemisphere chauvinism. It was a very limited need, in Virginia, so good enough. Aside from the hemisphere issue, the code is also

Re: DateTime-season?

2008-01-29 Thread Zefram
David E. Wheeler wrote: return $date lt '03-21' ? 'winter' : $date lt '06-21' ? 'spring' Northern hemisphere chauvinism. Aside from the hemisphere issue, the code is also wrong for tropical latitudes, where the four-season system doesn't apply. If you're trying to answer a

Re: DateTime-season?

2008-01-29 Thread Eugene van der Pijll
Zefram schreef: Sounds like you're looking for the equinox and solstice dates. I don't see any CPAN module providing this, on search.cpan.org. Take a look at the DateTime::Util::Astro modules. solar_longitude_before and _after are useful to look for equinoxes and solstices, but you don't need

DateTime-season?

2008-01-28 Thread David E . Wheeler
Hey All, Someone on the Bricolage list needed a season method, so I whipped up this ugly one: sub season { my $date = shift-strftime('%m-%d'); return $date lt '03-21' ? 'winter' : $date lt '06-21' ? 'spring' : $date lt '09-21' ? 'summer'

Re: DateTime-season?

2008-01-28 Thread Rick Measham
David E. Wheeler wrote: Hey All, Someone on the Bricolage list needed a season method, so I whipped up this ugly one: sub season { my $date = shift-strftime('%m-%d'); return $date lt '03-21' ? 'winter' : $date lt '06-21' ? 'spring' : $date lt

Re: DateTime-season?

2008-01-28 Thread Daisuke Maki
David, for some reason I *knew* you would be trying SolarTerm... Of course apparently the test failed for you (which seem to pass on my laptop, by the way), but anyhow. I was actually going to reply to this thread, but then I realized that DT::Event::SolarTerm isn't really worth it because