PeriodTools
in package
PeriodTools give us some basic and common methods for periods.
Tags
Table of Contents
- DATE_FORMAT = 'd-m-Y'
- applyFormatToDate() : string
- applyFormatToPeriod() : mixed
- applyPeriod() : mixed
- Applies on the start and end date indicated the relative format corresponding to the period indicated starting from the current date
- getFilterOptions() : array<string|int, mixed>
- Return list of periods for select base filter
- getPeriods() : array<string|int, mixed>
- Return list of available periods
Constants
DATE_FORMAT
public
mixed
DATE_FORMAT
= 'd-m-Y'
Methods
applyFormatToDate()
public
static applyFormatToDate(string $format[, string $dateFormat = self::DATE_FORMAT ][, string $date = '' ]) : string
Parameters
- $format : string
- $dateFormat : string = self::DATE_FORMAT
- $date : string = ''
Return values
string —applyFormatToPeriod()
public
static applyFormatToPeriod(string &$startDate, string &$endDate, string $startFormat, string $endFormat[, string $dateFormat = self::DATE_FORMAT ]) : mixed
Parameters
- $startDate : string
- $endDate : string
- $startFormat : string
- $endFormat : string
- $dateFormat : string = self::DATE_FORMAT
Return values
mixed —applyPeriod()
Applies on the start and end date indicated the relative format corresponding to the period indicated starting from the current date
public
static applyPeriod(string $period, string &$startDate, string &$endDate) : mixed
Parameters
- $period : string
- $startDate : string
- $endDate : string
Return values
mixed —getFilterOptions()
Return list of periods for select base filter
public
static getFilterOptions(Translator $i18n) : array<string|int, mixed>
Parameters
- $i18n : Translator
Return values
array<string|int, mixed> —getPeriods()
Return list of available periods
protected
static getPeriods() : array<string|int, mixed>