chronia
    Preparing search index...

    Function getMinutes

    • Get the minutes of the given date.

      This function validates arguments before processing and returns the minutes (0-59) of the given date. Returns NaN for invalid input.

      Parameters

      • date: number | Date

        The base date as a Date object or timestamp (number)

      Returns number

      The minutes as a number (0-59), or NaN if invalid

      // Get minutes from Date object
      const result = getMinutes(new Date(2025, 0, 15, 14, 30, 45));
      // Returns: 30

      // Get minutes from timestamp
      const result2 = getMinutes(1704067200000); // 2024-01-01 00:00:00
      // Returns: 0

      // Minutes at the end of an hour
      const result3 = getMinutes(new Date(2024, 11, 31, 23, 59, 59));
      // Returns: 59

      // Minutes at the start of an hour
      const result4 = getMinutes(new Date(2024, 5, 15, 8, 0, 0));
      // Returns: 0

      // Invalid date returns NaN
      const result5 = getMinutes(new Date("invalid"));
      // Returns: NaN
      • Validates arguments before conversion (consistent with library patterns)
      • Accepts both Date objects and numeric timestamps
      • Returns NaN for: Invalid Date, NaN, Infinity, -Infinity
      • Returns the minutes in the local timezone
      • Always returns a value between 0 and 59 for valid dates