Download the PHP package studioespresso/craft-date-range without Composer

On this page you can find all versions of the php package studioespresso/craft-date-range. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package craft-date-range

Date Range field for Craft CMS

What is says on the tin 🙂. This field gives you a start and end date in 1 field.

Requirements

This plugin requires Craft CMS 3, 4 or 5.

Installation

To install the plugin, follow these instructions.

  1. Open your terminal and go to your Craft project:

    cd /path/to/project
    composer require studioespresso/craft-date-range
    ./craft install/plugin date-range

Settings

The following options can be set on the field:

When the field is set to required, both start & end date (and if enabled time) will be required.

Default time values

Since a PHP DateTime object also has a time value, wether you entered on or not (or wether you have to option enabled to show the fields or not), the plugin tries to be smart in which time values get saved.

When you enable either or both time fields, that value will off course be safed. For fields that don't have time options set, 00:00:00 will get saved.

Upgrading to Craft 5

With Craft 5 comes multi-instance support (fields can be used multiple times in the same layout) and this adds a bit of complexity for the Date Range plugin. In the query behaviour, you'll need to add the handle of the entry type you're trying to query as a second argument.

`

Templating

Element queries

⚠️ Using date range fields in your entry queries is possible but requires the site to be running MySQL 5.7 or later or PostgreSQL 9.3 or later.

Example:

The plugin includes isOnGoing(), isPast(),isNotPast() and isFuture() query behaviors. The second argument passed should be the handle of the entry type you want to query.

You can optionally pass true as a third argument to the query to make it include events that happen today in future/past/onGoing queries.

Field values

When using the field in your template, you have access to both start and end properties, as well as:

getFormatted()

When using the getFormatted() function, you can pass paramters in 2 ways: 1) a date format and a separator string (eg: entry.dateRangeHandle.formatted("d/m/Y Hi", "until"|t))
2) an array with a date and a time key and a separator string (eg: entry.dateRangeHandle.formatted({ date: 'd/m/Y', time: 'H:i:s'}, 'tot'|t))

With this second option, the field can output date and time seperatly and when the start and end dates are the same, it will only ouput one, using the separate time formates for the start and end times (eg 30/04/2020 11:00 until 16:00 )

GraphQL

The field has full support for Craft's GraphQL api, which was added in Craft CMS 3.3 You have access to the same properties as you do in Twig, and you can also use Craft's @formatDateTime to change the date formats.


Brought to you by Studio Espresso


All versions of craft-date-range with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
craftcms/cms Version ^5.0.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package studioespresso/craft-date-range contains the following files

Loading the files please wait ....