import moment from 'moment';

const defaultformat = 'D MMMM Y'

export default function parseDateLocale(date, format = defaultformat) {
    if(moment.locale() === 'th') {
        const dateParse = moment(date).add(543,'year');
        return dateParse.isValid() ? dateParse.format(format) : '';
    }
    const dateParse = moment(date);
    return  dateParse.isValid() ? dateParse.format(format) : '';
}