Function dayOfMonth

  • Extracts the day of the month as a number from a given date string.

    Example

    dayOfMonth("07/03/2023")
    // => { ok: true, value: '3' }

    Example

    Handle invalid input:

    dayOfMonth(10)
    // => { ok: false, error: Error('[dates.dayOfMonth] Expected string value as input') }

    Parameters

    • dateStr: string

      The date string to extract the day of the month from.

    Returns Result<number, Error>

    A Result object with either the day of the month as a number on success, or an Error object if the input value is not a valid date string.

Generated using TypeDoc v0.24.7