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 of the astronomical
calculations that it depends on. It takes time to generate the solar
terms, and they are pretty far off from the dates you described in your
email.
For example, "Winter" in terms of solar terms is circa late October to
late January. April follows it up to sometime in April. April to early
August is summer and the rest until sometime in late September / early
October.
In other words, it varies from year to year, and it's really tied to the
location of the Sun.
For editorial purposes, you probably want something more fixed.
--d
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 '09-21' ? 'summer'
: $date lt '12-21' ? 'autumn'
: 'winter';
}
Since seasons can sometimes change on the 22nd instead of the 21st, this
isn't quite right. Anyone else done something like this but more accurate?
Best,
David