diff options
Diffstat (limited to 'app/assets/javascripts/analytics/shared')
-rw-r--r-- | app/assets/javascripts/analytics/shared/utils.js | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/app/assets/javascripts/analytics/shared/utils.js b/app/assets/javascripts/analytics/shared/utils.js index 84189b675f2..52901d4c5bb 100644 --- a/app/assets/javascripts/analytics/shared/utils.js +++ b/app/assets/javascripts/analytics/shared/utils.js @@ -1,4 +1,9 @@ +import dateFormat from 'dateformat'; +import { dateFormats } from './constants'; + export const filterBySearchTerm = (data = [], searchTerm = '', filterByKey = 'name') => { if (!searchTerm?.length) return data; return data.filter((item) => item[filterByKey].toLowerCase().includes(searchTerm.toLowerCase())); }; + +export const toYmd = (date) => dateFormat(date, dateFormats.isoDate); |