You are here

function partial_date_month_matrix in Partial Date 7

Maps out the valid month ranges for a given year.

Parameters

int $year:

Return value

array Note, there is no array index.

3 calls to partial_date_month_matrix()
partial_date_field_populate_components in ./partial_date.admin.inc
This generates the best estimate for the date components based on the submitted values.
partial_date_mktime in ./partial_date.module
Creates a timestamp based on the available components.
_partial_date_element_validate in ./partial_date.admin.inc
TODO: Validates the date type to stop dates like February 30, 2006.

File

./partial_date.module, line 1136
Defines a date element that allows for any combination of date granularity settings.

Code

function partial_date_month_matrix($year = NULL) {
  if ($year && partial_date_is_leap_year($year)) {
    return array(
      31,
      29,
      31,
      30,
      31,
      30,
      31,
      31,
      30,
      31,
      30,
      31,
    );
  }
  return array(
    31,
    28,
    31,
    30,
    31,
    30,
    31,
    31,
    30,
    31,
    30,
    31,
  );
}