cezarneaga
9/26/2017 - 7:26 AM

filterByDateCond

Filter an array by date condition and return certain props only with Ramda.

const array = [{id: 1, createdAt: '2016-09-22 15:55:08'}, {id: 2, createdAt: '2017-11-22 15:55:08'}]
const dateCheck = date =>
        new Date(date).getFullYear() >= new Date().getFullYear()

R.pluck('id', R.filter(R.propSatisfies(dateCheck, 'createdAt'))(array))