{"size": 334, "ext": "js", "max_stars_repo_path": "packages/utils/src/formatDate.js", "max_stars_repo_name": "ehealth-ua/ehealth.web", "max_stars_repo_stars_event_min_datetime": "2019-06-26T12:48:22.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-11T09:20:56.000Z", "max_issues_repo_path": "packages/utils/src/formatDate.js", "max_issues_repo_name": "ehealth-ua/ehealth.web", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "packages/utils/src/formatDate.js", "max_forks_repo_name": "ehealth-ua/ehealth.web", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 5, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 25.6923076923, "max_line_length": 78, "alphanum_fraction": 0.5868263473}
const formatDate = value => {
  if (typeof value !== "string") return value;

  const digits = value.replace(/\D/g, "").slice(0, 8);

  // [_matches, year, month, day]
  const [, year, month, day] = /(\d{0,4}?)(\d{0,2}?)(\d{0,2}?)$/.exec(digits);

  return [day, month, year].filter(Boolean).join(".");
};

export default formatDate;
