Encaf Double Date

Developer

Chad Crowell - Encaffeinated

3rd Party (Free)

2 downloads (last 90 days)

Creative Commons Attribution Non-Commercial No Derivatives Download v1.6

EE Version Support

  • ExpressionEngine 2

Compatibility

If an item is crossed out, it might be untested, not applicable or incompatible. Contact the developer to be sure.

  • Updater
  • Multi Site Manager
  • Stand Alone Entry Form
  • Low Variables
  • Content Elements
  • Better Workflow
  • Matrix
  • Grid
  • Webservice
  • Publisher

Requirements

  • jQuery for the Control Panel

Add-On Type(s)

Plugin

Tags

Return a well-formatted date/time for event durations.

If you have entries with start and end dates that need to be exposed n your templates (whether defined via the native entry_date and expiration_date, custom date fields, or any combination thereof), it can be cumbersome to show them in a friendly manner if some entries occur only on a single day, some on multiple days, and some that have start and end times that matter, and some that do not. You may end up writing some very convoluted nested if/then statements, which can degrade performance in ExpressionEngine, or compromising with visual output. Double Date will help out by doing these sorts of things:

SAME DAY, DATE, MONTH, YEAR and TIME
Before: Monday, January 1, 2012, 12:00pm - Monday, January 1, 2012, 12:00pm
After: Monday, January 1, 2012, 12:00pm
Or: January 1, 2012, 12:00pm (with show_day=“no”)
Or: Monday, January 1, 2012 (with show_time=“no”)
Or: Monday, January 1, 12:00pm (with show_year=“no”)
Or: January 1, 12:00pm (with show_day=“no” and show_year=“no”)
Or: January 1 (with show_day=“no” and show_time=“no” and show_year=“no”)

SAME DAY, DATE, MONTH, YEAR, DIFF TIME
Before: Monday, January 1, 2012, 12:00pm - Monday, January 1, 2012, 1:00pm
After: Monday, January 1, 2012, 12:00pm - 1:00PM
Or: January 1, 2012, 12:00pm - 1:00pm (with show_day=“no”)
Or: Monday, January 1, 2012 (with show_time=“no”)
Or: Monday, January 1, 12:00pm - 1:00pm (with show_year=“no”)
Or: January 1, 12:00pm - 1:00pm (with show_day=“no” and show_year=“no”)
Or: January 1 (with show_day=“no” and show_time=“no” and show_year=“no”)

SAME MONTH, YEAR, DIFF DAY and DATE, TIME IRRELEVANT
Before: Monday, January 1, 2012, 12:00pm - Wednesday, January 3, 2012, 12:00pm
After: Monday, January 1 - Wednesday, January 3, 2012, 12:00pm
Or: January 1-3, 2012, 12:00pm (with show_day=“no”)
Or: Monday, January 1 - Wednesday, January 3, 2012 (with show_time=“no”)
Or: Monday, January 1 - Wednesday, January 3, 12:00pm (with show_year=“no”)
Or: January 1-3, 12:00pm (with show_day=“no” and show_year=“no”)
Or: January 1-3 (with show_day=“no” and show_time=“no” and show_year=“no”)
Or: January 1-3, 2012 (with show_day=“no” and show_time=“no”)

DIFF MONTH, SAME YEAR, TIME IRRELEVANT
Before: Monday, January 1, 2012, 12:00pm - Wednesday, February 10, 2012, 12:00pm
After: Monday, January 1, 2012 - Wednesday, February 10, 2012, 12:00pm
Or: January 1 - February 3, 2012, 12:00pm (with show_day=“no”)
Or: Monday, January 1 - Wednesday, February 3, 2012 (with show_time=“no”)
Or: Monday, January 1 - Wednesday, February 3, 12:00pm (with show_year=“no”)
Or: January 1 - February 3, 12:00pm (with show_day=“no” and show_year=“no”)
Or: January 1 - February 3 (with show_day=“no” and show_time=“no” and show_year=“no”)

Double Date will perform the above type transformations and others based on the start and end dates provided.

INSTALLATION
Place the double_date folder in your system > expressionengine > third_party folder.

CONFIGURATION
N/A

USAGE
Just pass the entry’s entry_date and expiration_date into the plugin (or other custom date fields instead if necessary).

{exp:channel:entries channel=“my_channel”}

{exp:double_date
start=”{entry_date}”
end=”{expiration_date}”
split_dates=“no”
show_day=“yes”
show_time=“yes”
show_year=“yes”
format_day=“D”
format_month=“M”
format_date=“d”
format_year=“y”
format_hour=“G”
format_min=“i”
format_ampm=“A”
}

{/exp:channel:entries}

PARAMETERS
start: a Unix timestamp formatted date representing the start date/time (required). An entry’s entry_date or a custom date field will work.

end: a Unix timestamp formatted date representing the end date/time (required). An entry’s expiration_date or a custom date field will work.

split_dates: (yes/no) do you want a


inserted between the start date/time and end date/time (optional, default no)

show_day: (yes/no) do you want to show day names (Monday, Tuesday, etc.) as part of the output (optional, default yes)

show_time: (yes/no) do you want to show the time (10:00am) as part of the output (optional, default yes)

show_year: (yes/no) do you want to show the year (2012) as part of the output (optional, default yes)

Formatting: The below (optional) parameters allow you to customize the formatting of the output. For instance, you can format the month as either January, Jan, 01, or 1 by specifying different several different format_month parameters (F, M, m, or n) based on the available PHP date formatting settings documented at http://php.net/manual/en/function.date.php

format_day: (optional, default l)
format_month: (optional, default F)
format_date: (optional, default j)
format_year: (optional, default Y)
format_hour: (optional, default g)
format_min: (optional, default i)
format_ampm: (optional, default a)

—————————-
SOLSPACE CALENDAR
—————————-

Note special formatting of start and end parameters below, as well as the addition of the start_time, end_time and solspace parameters. Also note that the start, end, start_time and end_time parameters must be formatted exaclty as shown below. Just copy and paste them into your template.

{exp:double_date
start=”{event_start_date format=’%m-%d-%Y’}”
end=”{event_end_date format=’%m-%d-%Y’}”
start_time=”{event_start_date format=’%G-%i-%s’}”
end_time=”{event_end_date format=’%G-%i-%s’}”
solspace=“yes”
split_dates=“no”
show_day=“no”
show_time=“yes”
show_year=“yes”
format_day=“D”
format_month=“M”
format_date=“d”
format_year=“Y”
format_hour=“g”
format_min=“i”
format_ampm=“a”
}

Download Encaf Double Date

EE Support Downloads Add-On Version Release Date
Not Specified Download 1.6 Aug 21, 2014

This entry was created March 26, 2012, 11:53 am.
This entry was last updated August 21, 2014, 5:07 pm.

Disclaimer: Information about ExpressionEngine add-ons is provided as a service to you, the user, and every member of the ExpressionEngine community. devot:ee is not responsible if you hose, mangle, wreck, or otherwise destroy your EE website by installing an add-on that you found out about at this site, regardless of its rating, Favorites status, commercial or free status, or general popularity. Caveat EEmptor!

Returns: devot:ee has a 30-day return policy on all commercial add-ons sold through devot-ee.com. If you need to return an add-on, do not go to the developer or the developer's site, but rather visit our returns page at https://devot-ee.com/returns to initiate your return. If you have questions, email support@devot-ee.com.

There are no reviews for this add-on yet.

What are you waiting for? Rate it and review it!