UNPKG

@js-sugar/date

Version:

A multi-calendar, tree-shakable, extensible, immutable and lightweight date library for JavaScript

16 lines (15 loc) 502 B
import { DateTime } from '../main'; /** * @name setYear * @category plugins * @summary Set the year to the given date. * @description * @param {DateTime} date - the date to be changed * @param {Number} year - the year of the new date * @returns {DateTime} the new date with the year set * * @example * setYear(new DateTime(2004,2,29), 2003) will be date of 2003-2-28 * because 2004 was a leap year. */ export declare function setYear(date: DateTime, year: number): DateTime;