Skip to content

Instantly share code, notes, and snippets.

@jorinvo
Last active November 20, 2015 09:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jorinvo/3d3e100a2cdb8d5418fb to your computer and use it in GitHub Desktop.
Save jorinvo/3d3e100a2cdb8d5418fb to your computer and use it in GitHub Desktop.
readable?
const toISOString = ifElse(
either(isNil, compose(isEmpty, trim)),
always(null),
d => new Date(d).toISOString()
)
function toISOString (date) {
if (isNil(date) || isEmpty(date.trim())) {
return null
}
return new Date(date).toISOString()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment