import { HookContext } from '@feathersjs/feathers'; import { populate, alterItems } from 'feathers-hooks-common'; import moment from 'moment'; import _ from 'lodash'; const formatDate = (fieldName = 'date') => alterItems(item => { const date = _.get(item, fieldName); return _.set(item, fieldName, moment(date).format('YYYY-MM-DD')); }); export default formatDate;