/* eslint-disable import/no-extraneous-dependencies, no-underscore-dangle */

import moment from 'moment';

export function formatDay(day, locale = 'en') {
  return moment(day)
    .locale(locale)
    .format('ddd ll');
}

export function formatMonthTitle(date, locale = 'en') {
  return moment(date)
    .locale(locale)
    .format('MMMM YYYY');
}

export function formatWeekdayShort(day, locale = 'en') {
  return moment()
    .locale(locale)
    ._locale.weekdaysMin()[day];
}

export function formatWeekdayLong(day, locale = 'en') {
  return moment()
    .locale(locale)
    ._locale.weekdays()[day];
}

export function getFirstDayOfWeek(locale = 'en') {
  const localeData = moment.localeData(locale);
  return localeData.firstDayOfWeek();
}

export function getMonths(locale = 'en') {
  const months = [];
  let i = 0;
  while (i < 12) {
    months.push(
      moment()
        .locale(locale)
        .month(i)
        .format('MMMM')
    );
    i += 1;
  }
  return months;
}

export default {
  formatDay,
  formatMonthTitle,
  formatWeekdayShort,
  formatWeekdayLong,
  getFirstDayOfWeek,
  getMonths,
};

@@ -974,24 +974,309 @@
  months;%0A%7D%0A%0A
+export function formatDate(str, format = 'L', locale = 'en') %7B%0A  return moment(str)%0A    .locale(locale)%0A    .format(format);%0A%7D%0A%0Aexport function parseDate(str, format = 'L') %7B%0A  const m = moment(str, format, true);%0A  if (m.isValid()) %7B%0A    return m.toDate();%0A  %7D%0A  return undefined;%0A%7D%0A%0A
 export defau
@@ -1390,11 +1390,38 @@
 Months,%0A
+  formatDate,%0A  parseDate,%0A
 %7D;%0A

Add formatDate and parseDate to MomentLocaleUtils