Skip to content

Instantly share code, notes, and snippets.

@cezarneaga
Created September 26, 2017 07:26
Show Gist options
  • Save cezarneaga/ed372f4e8e5b7477ee4a85a27ac50c8f to your computer and use it in GitHub Desktop.
Save cezarneaga/ed372f4e8e5b7477ee4a85a27ac50c8f to your computer and use it in GitHub Desktop.
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))
@cezarneaga
Copy link
Author

what are the ways one could do this better?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment