Calculates the number of days in a particular year. Varies by the leap year.

Type signature

(year: number) => 366 | 365

Examples

daysInYear(2019);
// ⇒ 365
Try in REPL
daysInYear(2020);
// ⇒ 366
Try in REPL

Questions

  • How many days are in a particular year?
  • How many days are in a leap year?
  • How many days are in a common year?

TypeScript sourceJavaScript source