getYear.d.ts 644 B

123456789101112131415161718192021222324252627
  1. import type { ContextOptions, DateArg } from "./types.js";
  2. /**
  3. * The {@link getYear} function options.
  4. */
  5. export interface GetYearOptions extends ContextOptions<Date> {}
  6. /**
  7. * @name getYear
  8. * @category Year Helpers
  9. * @summary Get the year of the given date.
  10. *
  11. * @description
  12. * Get the year of the given date.
  13. *
  14. * @param date - The given date
  15. * @param options - An object with options
  16. *
  17. * @returns The year
  18. *
  19. * @example
  20. * // Which year is 2 July 2014?
  21. * const result = getYear(new Date(2014, 6, 2))
  22. * //=> 2014
  23. */
  24. export declare function getYear(
  25. date: DateArg<Date> & {},
  26. options?: GetYearOptions | undefined,
  27. ): number;