---
name: "HTML::CalendarMonth::Locale"
section: "3pm"
platform: "linux"
package: "libhtml-calendarmonth-perl"
version: "2.04-2"
release: "Debian 10 (Buster)"
platforms: ["linux"]
url: "https://new.carta.tech/HTML::CalendarMonth::Locale"
---

# HTML::CalendarMonth::Locale(3pm)

Front end class for DateTime::Locale

## NAME

HTML::CalendarMonth::Locale - Front end class for DateTime::Locale

## SYNOPSIS

```
  use HTML::CalendarMonth::Locale;
  my $loc = HTML::CalendarMonth::Locale->new( code => 'en-US' );
  # list of days of the week for locale
  my @days = $loc->days;
  # list of months of the year for locale
  my @months = $loc->months;
  # the name of the current locale, as supplied the code parameter to
  # new()
  my $locale_name = $loc->code;
  # the actual DateTime::Locale object
  my $loc = $loc->loc;
  1;
```

## DESCRIPTION

HTML::CalendarMonth utilizes the powerful locale capabilities of DateTime::Locale for rendering its calendars. The default locale is 'en-US' but many others are available. To see this list, invoke the class method HTML::CalendarMonth::Locale-\>**locales()** which in turn invokes **DateTime::Locale::codes()**.

This module is mostly intended for internal usage within HTML::CalendarMonth, but some of its functionality may be of use for developers:

## METHODS

- **new()**

  Constructor. Takes the following parameters:

  - code

    Locale code, e.g. 'en-US'.

  - full\_days

    Specifies whether full day names or their abbreviations are desired. Default 0, use abbreviated days.

  - full\_months

    Specifies whether full month names or their abbreviations are desired. Default 1, use full months.

- **code()**

  Returns the locale code used during object construction.

- **locale()**

  Accessor method for the DateTime::Locale class, which in turn offers several class methods of specific interest. See DateTime::Locale.

- **locale\_map()**

  Returns a hash of all available locales, mapping their code to their full name.

- **loc()**

  Accessor method for the DateTime::Locale instance as specified by `"code"`. See DateTime::Locale.

- **locales()**

  Lists all available locale codes. Equivalent to **locale()**-\>**codes()**, or DateTime::Locale-\>**codes()**.

- **days()**

  Returns a list of days of the week, Sunday first. These are the actual unique day strings used for rendering calendars, so depending on which attributes were provided to `"new()"`, this list will either be abbreviations or full names. The default uses abbreviated day names. Returns a list in list context or an array ref in scalar context.

- **narrow\_days()**

  Returns a list of short day abbreviations, beginning with Sunday. The narrow abbreviations are not guaranteed to be unique (i.e. 'S' for both Sat and Sun).

- **days\_minmatch()**

  Provides a hash reference containing minimal case-insensitive match strings for each day of the week, e.g., 'sa' for Saturday, 'm' for Monday, etc.

- **months()**

  Returns a list of months of the year, beginning with January. Depending on which attributes were provided to `"new()"`, this list will either be full names or abbreviations. The default uses full names. Returns a list in list context or an array ref in scalar context.

- **narrow\_months()**

  Returns a list of short month abbreviations, beginning with January. The narrow abbreviations are not guaranteed to be unique.

- **months\_minmatch()**

  Provides a hash reference containing minimal case-insensitive match strings for each month of the year, e.g., 'n' for November, 'ja' for January, 'jul' for July, 'jun' for June, etc.

- **daynums()**

  Provides a hash reference containing day of week indices for each fully qualified day name as returned by **days()**.

- daynum($day)

  Provides the day of week index for a particular day name.

- dayname($day)

  Provides the fully qualified day name for a given string or day index.

- **monthnums()**

  Provides a hash reference containing month of year indices for each fully qualified month name as returned by **months()**.

- monthnum($month)

  Provides the month of year index for a particular month name.

- monthname($month)

  Provides the month name for a given string or month index.

- minmatch\_hash(@list)

  This is the method used to generate the case-insensitive minimal match hash referenced above. Given an arbitrary list, a hash reference will be returned with minimal match strings as keys and the original strings as values.

- lc\_minmatch\_hash(@list)

  Same as minmatch\_hash, except keys are forced to lower case.

- **first\_day\_of\_week()**

  Returns a number from 0 to 6 representing the first day of the week for this locale, where 0 represents Sunday.

## AUTHOR

Matthew P. Sisk, \<*sisk@mojotoad.com*\>

## COPYRIGHT

Copyright (c) 2010-2015 Matthew P. Sisk. All rights reserved. All wrongs revenged. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

## SEE ALSO

**HTML::CalendarMonth**(3), **DateTime::Locale**(3)
