• Get a date associated with a "datum" style object.

    This function will return a Date instance found via a property on d according to these rules:

    1. date - assumed to be a Date object already and returned directly
    2. localDate - a string in yyyy-MM-dd form, optionally with a string localTime property for an associated time in HH:mm form, treated as UTC
    3. created - a string in yyyy-MM-dd HH:mm:ss.SSS'Z' or yyyy-MM-dd'T'HH:mm:ss.SSS'Z' form

    These properties are commonly returned in results from the SolarNetwork API, and thus this method is a handy way to get the dates for those objects.

    Note that the localDate and localTime values are parsed as UTC. When formatted the date for display they should be formatted in UTC as well to preserve the expected value.

    Parameters

    • Optional d: {
          created?: string;
          date?: Date;
          localDate?: string;
          localTime?: string;
      }

      the datum object to extract a date from

      • Optional created?: string
      • Optional date?: Date
      • Optional localDate?: string
      • Optional localTime?: string

    Returns Date | null

    the extracted date, or null if no date could be extracted

Generated using TypeDoc