const ensureDate = function ensureDate(d) {
  if (d instanceof Date) {
    return d;
  }
  try {
    const date = new Date(d);
    if (date.toString().toLowerCase() === 'invalid date') {
      return null;
    }
    return date;
  } catch (e) {
    return null;
  }
};
export default ensureDate;