Download the PHP package craftpulse/craft-timeloop without Composer
On this page you can find all versions of the php package craftpulse/craft-timeloop. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download craftpulse/craft-timeloop
More information about craftpulse/craft-timeloop
Files in craftpulse/craft-timeloop
Package craft-timeloop
Short Description This Craft plugin will generate an array of dates between a start and end date based on frequency.
License proprietary
Informations about the package craft-timeloop
Timeloop plugin for Craft CMS 3.x
This plugin created repeating dates without complex inputs
Requirements
This plugin requires Craft CMS 3.3.0 or later.
Installation
To install the plugin, follow these instructions.
-
Open your terminal and go to your Craft project:
-
Tell Composer to load the plugin:
- In the Control Panel, go to Settings → Plugins and click the “Install” button.
Timeloop Overview
The Timeloop plugin provides recurring dates based on a starting date and a regular loop period.
Example: Set a payment date for employees on the first of each month.
Configuring the Timeloop field.
The following configuration options that are available for the field:
- ShowTimes: When selected, this will give the ability to choose a starting time and end time for the recurring dates.
Using Timeloop
The Timeloop Model
Getting the entered dates (returned as DateTime objects)
Getting the start date for the loop (this includes the time set in loopStartTime
):
Getting the end date for the loop (this includes the time set in loopEndHour
):
Getting the start time for the loop:
Getting the end time for the loop:
Getting an array of dates between the selected start and end dates (Array with DateTime Objects):
This generated set of dates takes all the field values into consideration (frequency, cycle and custom)
Upcoming Dates (returned as DateTime Objects)
Getting the first upcoming date:
Getting the next upcoming date:
Get entries between certain dates
If you want to fetch entries from a certain section between two dates. You can fetch them by giving the ElementsQuery with the name of the timeloop field, start and end date. This will return you an array of recurring dates per entry between this period. If no dates are defined, you will get an empty array. In the returned array, you can find the entry id, entry title and the dates.
Returns this array layout
Period Model
Getting the frequency (DateTimePeriod String):
Getting the cycle (Integer):
Displaying the selected days (Array):
This will parse the names of the selected days when weekly has been chosen as frequency.
Timestring Model
Get the ordinal of a monthly set loop (e.g. first, second, ..., last)
warning: If the frequency is not set to monthly, the returned value will be null
.
warning: If the frequency is set to monthly and no timestring selection has been made, the returned value will be none
as String
.
Reminder Model (WIP - not ready for production)
GraphQL
If you want to use the plugin through GraphQL, we've added a GraphQL Type to provide the field data.
You can get the DateTime Types from the data directly for
loopStartDate
will return the start dateloopStartTime
will return the start time, defaults to00:00:00
when no start time has been entered orshowTimes
is set to false.loopEndDate
will return the end dateloopEndTime
will return the end time, defaults to23:59:59
when no end time has been entered orshowTimes
is set to false.loopReminder
Loop Period
You can get the loopPeriod
object as follows:
frequency
will return the selected frequency ( P1D / P1W / P1M / P1Y )cycle
will return the entered cycle valuedays
will return an Array that contains the selected days of the weektimestring
will return an object that contains theordinal
(e.g. last) andday
(e.g. saturday)
The Dates
To get an array of formatted dates, use dates
.
Dates arguments:
- limit (Integer): add a limit of dates you want to return, default to
100
. - futureDates (Boolean): if you want to show future dates only, default to
true
.
Dates directives:
formatDateTime(timezone: "Europe/London" format: "d/m/Y")
Timeloop Roadmap
Potential features for the future:
- Reminder Support
- Make the fieldtype translatable
- Provide language translations
- Add the possibility to blocklist dates
- Add holiday settings
- Localise holidays based on the CraftCMS timezone settings
And many more!
Brought to you by Percipio.London
All versions of craft-timeloop with dependencies
craftcms/cms Version ^4.0.0-beta.1
nystudio107/craft-plugin-vite Version ^4.0.0-beta.1