@jagaad/utils
    Preparing search index...

    Function toDate

    • Converts a value to a Date object.

      toDate('2023-10-01'); // Date object for October 1, 2023
      toDate(1738358400000); // Date object for October 1, 2023
      toDate(new Date('2023-10-01')); // Date object for October 1, 2023
      toDate('invalid-date'); // undefined
      toDate(null); // undefined
      toDate(undefined); // undefined

      Parameters

      • value: Maybe<string | number | Date>

      Returns undefined | Date