NAME
Time::Keeper::MonthDay - a month and a day, in no year
VERSION
Version 0.11
SYNOPSIS
use Time::Keeper;
my $md = Time::Keeper::MonthDay->new(month => 2, day => 29);
my $md = Time::Keeper::MonthDay->parse('--02-29');
my $md = $t->to_month_day;
$md->in_year(2024); # a Time::Keeper::Date, 2024-02-29
$md->in_year(2027, end_of_month => 'limit'); # 2027-02-28
$md->format('MMMM d'); # February 29
"$md"; # --02-29
DESCRIPTION
A month and a day in no year: a birthday, an anniversary, a holiday that falls on the same date every year. 29 February is one. It has no year, so no day of the week, no quarter, no arithmetic; "in_year" gives a Time::Keeper::Date when a year is chosen.
CONSTRUCTORS
new
Time::Keeper::MonthDay->new(month => 2, day => 29);
Both are required; a day no month has is an error.
parse
strptime
parse_cldr
Time::Keeper::MonthDay->parse('--02-29'); # also --0229 and 02-29
Time::Keeper::MonthDay->strptime('29/02', '%d/%m');
Time::Keeper::MonthDay->parse_cldr('29 February', 'd MMMM');
parse reads ISO 8601's --MM-DD and --MMDD, and MM-DD. Under a pattern a year the pattern reads is dropped, so 29 February stands whatever year the text named. Each takes locale.
try_new
try_parse
try_strptime
try_parse_cldr
As the method without try_, but undef where it would die, with $@ left as it was.
ACCESSORS
month
day
locale
month_name
month_abbr
As Time::Keeper::Date's.
NEW VALUES FROM OLD
with
$md->with(day => 1);
in_locale
The same month and day in another locale.
in_year
$md->in_year(2024);
$md->in_year(2027, end_of_month => 'limit'); # 28 February
$md->in_year(2027, end_of_month => 'wrap'); # 1 March
The date in that year. 29 February in a common year is an error unless end_of_month says what to do: limit gives the last day of the month, wrap the day after it.
COMPARING AND PRINTING
compare
As "compare" in Time::Keeper::Date, between months and days only.
iso8601
TO_JSON
--02-29; "$md" is the same.
FORMATTING
strftime
format
format_date
format_skeleton
$md->format('MMMM d');
$md->strftime('%d %B');
$md->format_date('long'); # February 29, the locale's MMMMd skeleton
$md->format_skeleton('MMMd');
A letter that needs a year, a day of the week, a time or a zone is an error naming it. format_date uses the locale's MMMMd (full and long), MMMd (medium) and Md (short) skeletons.
SERIALISATION
STORABLE_freeze
STORABLE_thaw
FREEZE
THAW
As Time::Keeper::Date's.
SEE ALSO
Time::Keeper, Time::Keeper::Date, Time::Keeper::YearMonth.
AUTHOR
LNATION, <email at lnation.org>
LICENSE AND COPYRIGHT
This software is Copyright (c) 2026 by LNATION.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)