Format ISO date - JS
Format date from ISO string to different formats
Last updated: 29 Oct 2022
# javascript
import moment from 'moment';export const formatDate = (value, includeYear = true) => {/* Takes the date and returns it in this format 'Mar 21' */return includeYear? moment(value).format('MMM Do, YYYY'): moment(value).format('MMM Do');};
/* Takes the date and returns it in this format '2022-04-27' */var date = new Date();date.toISOString().substring(0, 10);