sheng-tool
    Preparing search index...

    Function getDaysInMonth

    • 取得指定时间所在月份的天数,如果不传参,则指定当前时间

      Parameters

      • date: Date = ...

        指定时间

      Returns number

      0.0.1

      getDaysInMonth(new Date('2021/03/01'))     // 31
      getDaysInMonth(new Date('2021/02/05')) // 28
      getDaysInMonth(new Date('2020/09/03')) // 30
      getDaysInMonth(new Date('2024/02/08')) // 29