import * as moment from 'moment';

export function parseUserInputDate(value?: string, format?: string): Date | undefined {
    if (!value || !format) return;
    if (value.length !== format.length) return;
    const date = moment(value, format);
    if (!date.isValid()) return;
    return date.toDate();
}
