{"size": 634, "ext": "js", "max_stars_repo_path": "src/js/utils/date.js", "max_stars_repo_name": "desafinadude/muni-portal-frontend", "max_stars_repo_stars_event_min_datetime": "2021-09-23T15:47:41.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-23T15:47:41.000Z", "max_issues_repo_path": "src/js/utils/date.js", "max_issues_repo_name": "desafinadude/muni-portal-frontend", "max_issues_repo_issues_event_min_datetime": "2020-10-15T05:58:57.000Z", "max_issues_repo_issues_event_max_datetime": "2021-10-14T07:52:59.000Z", "max_forks_repo_path": "src/js/utils/date.js", "max_forks_repo_name": "desafinadude/muni-portal-frontend", "max_forks_repo_forks_event_min_datetime": "2020-10-15T05:04:47.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-07T10:29:54.000Z"}
{"max_stars_count": 1, "max_issues_count": 67, "max_forks_count": 4, "avg_line_length": 35.2222222222, "max_line_length": 83, "alphanum_fraction": 0.7129337539}
/**
 * Converts and returns valid ISO date strings to locale date string.
 * This excludes the time and only returns the date
 * @param {String} isoDateString - The ISO date string to convert
 * @param {boolean} [stripTime] - Exclude the time from date string [default: true]
 * @return {String} locale date string or error if provided date invalid
 */
export function getDateString(isoDateString, stripTime = true) {
  try {
    if (stripTime) {
      return new Date(isoDateString).toLocaleDateString();
    }
    return new Date(isoDateString).toLocaleString();
  } catch (error) {
    return "Invalid date format provided";
  }
}
