Description

Twigkit service for useful date functions

Methods

dateSortResults(results, dateField, oldestFirst)

Sort results array by date

Parameters

ParamTypeDetails
resultsmixedArray of results from response
dateFieldstringResult field to use for ordering
oldestFirstbooleanIf true the results will be order from oldest to newest

Returns

mixedSorted array of results

groupByDateRanges(results, dateField, groupBy)

Group results into date ranges, used for the timeline

Parameters

ParamTypeDetails
resultsmixedSorted array of results
dateFieldstringResult field to use for ordering
groupBystringOptionally specify how to group the results, by default it tries to get the best fit

Returns

mixedArray of grouped results