Appearance
wm-kit / Exports / getMonthDays
Function: getMonthDays
▸ getMonthDays(date?): number
获取某个月有多少天
Parameters
| Name | Type | Description |
|---|---|---|
date? | string | Date | Dayjs | 时间,需要查询的年月,可以是字符串也可以是Date类型,不传则查询当前月份 |
Returns
number
示例:
ts
import { getMonthDays } from 'wm-kit'
getMonthDays(new Date('2023-2-1')) // => 28
getMonthDays('2023-8') // => 31
getMonthDays('2023-7-1') // => 31
getMonthDays() // => 31Author
高强
Defined in
src/modules/date/index.ts:20