getDaysInMonth
Signature
Section titled “Signature”getDaysInMonth(value: string): numberimport { getDaysInMonth } from "@northguild/gmt/plain/calculate";Return the number of days in the month containing value.
- 28–31 depending on the month; February varies by leap year.
- Returns null on invalid input.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value |
string |
ISO PlainDate string |
Returns
Section titled “Returns”number of days in the month (28-31), or null on invalid input
Examples
Section titled “Examples”getDaysInMonth("2024-02-15") // 29 (leap year)getDaysInMonth("2023-02-15") // 28getDaysInMonth("2024-04-01") // 30getDaysInMonth("2024-01-01") // 31getDaysInMonth("invalid") // null