You are here

private function DatePickers::getjQueryUiDateFormatting in Better Exposed Filters 8.4

Same name and namespace in other branches
  1. 8.5 src/Plugin/better_exposed_filters/filter/DatePickers.php \Drupal\better_exposed_filters\Plugin\better_exposed_filters\filter\DatePickers::getjQueryUiDateFormatting()

Convert Date API formatting to jQuery formatDate formatting.

@todo To be honest, I'm not sure this is needed. Can you set a Date API field to accept anything other than Y-m-d? Well, better safe than sorry...

Return value

array PHP date format => jQuery formatDate format (comments are for the PHP format, lines that are commented out do not have a jQuery formatDate equivalent, but maybe someday they will...)

See also

http://us3.php.net/manual/en/function.date.php

http://docs.jquery.com/UI/Datepicker/formatDate

1 call to DatePickers::getjQueryUiDateFormatting()
DatePickers::exposedFormAlter in src/Plugin/better_exposed_filters/filter/DatePickers.php
Manipulate views exposed from element.

File

src/Plugin/better_exposed_filters/filter/DatePickers.php, line 120

Class

DatePickers
JQuery UI date picker widget implementation.

Namespace

Drupal\better_exposed_filters\Plugin\better_exposed_filters\filter

Code

private function getjQueryUiDateFormatting() {
  return [
    /* Day */

    // Day of the month, 2 digits with leading zeros 01 to 31.
    'd' => 'dd',
    // A textual representation of a day, three letters  Mon through
    // Sun.
    'D' => 'D',
    // Day of the month without leading zeros  1 to 31.
    'j' => 'd',
    // (lowercase 'L') A full textual representation of the day of the
    // week Sunday through Saturday.
    'l' => 'DD',
    // ISO-8601 numeric representation of the day of the week (added
    // in PHP 5.1.0) 1 (for Monday) through 7 (for Sunday).
    // 'N' => ' ',
    // English ordinal suffix for the day of the month, 2 characters
    // st, nd, rd or th. Works well with j.
    // 'S' => ' ',
    // Numeric representation of the day of the week 0 (for Sunday)
    // through 6 (for Saturday).
    // 'w' => ' ',
    // The day of the year (starting from 0) 0 through 365.
    'z' => 'o',
    /* Week */

    // ISO-8601 week number of year, weeks starting on Monday (added
    // in PHP 4.1.0) Example: 42 (the 42nd week in the year).
    // 'W' => ' ',.

    /* Month */

    // A full textual representation of a month, such as January or
    // March  January through December.
    'F' => 'MM',
    // Numeric representation of a month, with leading zeros 01
    // through 12.
    'm' => 'mm',
    // A short textual representation of a month, three letters  Jan
    // through Dec.
    'M' => 'M',
    // Numeric representation of a month, without leading zeros  1
    // through 12.
    'n' => 'm',
    // Number of days in the given month 28 through 31.
    // 't' => ' ',.

    /* Year */

    // Whether it's a leap year  1 if it is a leap year, 0 otherwise.
    // 'L' => ' ',
    // ISO-8601 year number. This has the same value as Y, except that
    // if the ISO week number (W) belongs to the previous or next
    // year, that year is used instead. (added in PHP 5.1.0).
    // Examples: 1999 or 2003.
    // 'o' => ' ',
    // A full numeric representation of a year, 4 digits Examples:
    // 1999 or 2003.
    'Y' => 'yy',
    // A two digit representation of a year  Examples: 99 or 03.
    'y' => 'y',
  ];
}