getDaysInYear.d.mts 681 B

12345678910111213141516171819202122
  1. /**
  2. * @name getDaysInYear
  3. * @category Year Helpers
  4. * @summary Get the number of days in a year of the given date.
  5. *
  6. * @description
  7. * Get the number of days in a year of the given date.
  8. *
  9. * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
  10. *
  11. * @param date - The given date
  12. *
  13. * @returns The number of days in a year
  14. *
  15. * @example
  16. * // How many days are in 2012?
  17. * const result = getDaysInYear(new Date(2012, 0, 1))
  18. * //=> 366
  19. */
  20. export declare function getDaysInYear<DateType extends Date>(
  21. date: DateType | number | string,
  22. ): number;