import pad from 'underscore.string/pad';

export default function (date) {
    if(!date) {
        return 'unknown';
    }
    if(!(date instanceof Date)) {
        date = new Date(date);
    }
    return [pad(date.getDate(), 2, '0'), pad(date.getMonth() + 1, 2, '0'), date.getFullYear()].join('/');
}

import i18next from '../utils/translation';

export default function (date) {
    if(!date) {
        return 'unknown';
    }
    if(!(date instanceof Date)) {
        date = new Date(date);
    }
    return new Intl.DateTimeFormat(i18next.language).format(date);
}

format date depending on selected language (via #808)