Local Calendar

1.0.1
Can Berkol
16.03.2012

Local Calendar is a datepicker fieldtype and a plugin that currently supports a datepicker for both Gregorian and Hijri calendars. The fieldtype also supports conversions of dates of the two calendar types. 

  • Hijri Calendar Support
  • Gregorian Calendar Support
  • Hijri to Gregorian Conversions

Installation

 

  1. Download and open the package.
  2. Upload bbr_localcalendar folder from system folder of package into system/expressionengine/third_party folder.
  3. Upload bbr_localcalendar folder from themes folder of package into themes/third_party folder.
  4. Go to Add-ons / Fieldtypes.
  5. Install the add-on.

Parameters

 

Field Type:
  • format
    Mimics the native EE date format parameter. It formats the output of date field.
  • lang
    Defines the output language. Accepts, arabic, english, turkish but you can add more translations.
  • to
    Defines the calendar type that the date will be converted to.
    gregorian, hijri

 

Plugin:

  • date
    Date in Y-m-d format. i.e. 2009-03-28
  • format_out
    Equals to format parameter of the field type.
  • from
    Defines the calendar type of the date entered.
    gregorian, hijri
  • to
    Defines the calendar type of the output date.
    gregorian, hijri

Format Parameter

 

Second:

  • %s     seconds       00 to 59
  • %U    seconds       since the epoch

Minutes:

  • %i     minutes       00 to 59

Hours:

  • %g     hour        12-hour format without leading zeros
  • %G    hour         24-hour format without leading zeros
  • %h     hour        12-hour format with leading zeros
  • %H    hour         24-hour format with leading zeros

   
AM/PM

  •     %a     am/pm
  •     %A     AM/PM

Day

  •  %d     day         of the month, 2 digits with leading zeros
  •  %D    day         of the week, textual, 3 letters
  • %j       day         of the month without leading zeros
  • %l       day         of the week, textual, long (lowercase L)
  • %w     day         of the week, numeric

Week

  • %W     week         number of year, weeks starting on Monday (ISO-8601)

Month

  • %m     month       00 to 12
  • %M      month       textual, three letters
  • %F       month       textual, long
  • %n       month      1 to 12
  • %t        days          in given month (number) 28 to 31

Year

  • %L     boolean       0 for no leap year, 1 for leap year
  • %y     year         2 digits
  • %Y     year         4 digits
  • %z     day         of the year 0 to 365

Other

  • %B     Swatch Internet Time
  • %I       Daylight saving time 1 if yes, 0 otherwise (capital i)
  • %O     Local time zone offset, in hours and seconds, against GMT
  • %r      RFC 822 formatting    Thu, 21 Dec 2000 16:01:07 +0200
  • %S     English ordinal suffix, 2 charecters th, nd etc.
  • %T     Time zone setting of this machine
  • %Z     Time zone offset in seconds. -43200 to 43200

CONSTANTS

  • {DATE_ATOM}          %Y-%m-%dT%H:%i:%s%Q
  • {DATE_COOKIE}      %l, %d-%M-%y %H:%i:%s UTC
  • {DATE_ISO8601}     %Y-%m-%dT%H:%i:%s%Q
  • {DATE_RFC822}      %D, %d %M %y %H:%i:%s %O
  • {DATE_RFC850}      %l, %d-%M-%y %H:%m:%i UTC
  • {DATE_RFC1036}    %D, %d %M %y %H:%i:%s %O
  • {DATE_RFC1123}    %D, %d %M %Y %H:%i:%s %O
  • {DATE_RFC2822}    %D, %d %M %Y %H:%i:%s %O
  • {DATE_RSS}             %D, %d %M %Y %H:%i:%s %O
  • {DATE_W3C}             %Y-%m-%dT%H:%i:%s%Q

Usage

 

Field Type:

{custom_date_field to="gregorian" format="%d-%M-%y" lang="arabic"}

Plugin:

{exp:bbr_localcalendar date="2012-01-23" from="gregorian" to="hijri" format_out="%D %M %Y" lang="arabic"}
{exp:bbr_localcalendar date="2012-01-23" from="gregorian" to="hijri" format_out="{DATE_ATOM}" lang="english"}