0.1.3 • Published 2 years ago
@doolooper/dodate v0.1.3
DoDate
A simple immutable solution to jalali/shamsi date without timezone
:warning: if you use date with time zone you will get different results :boom:
DoDate.now();Installation
$ npm install @doolooper/dodateor
$ yarn add @doolooper/dodatestatic methods
now(): DoDatefromDate(date: Date): DoDatefromJalali(year: number, month: number, day: number, hour: number = 0, minute: number = 0, second: number = 0): DoDateparse(date: string, pattern: string = "YYYY-MM-DDTHH:mm:ss"): DoDateparseJalali(date: string, pattern: string = "YYYY-MM-DDTHH:mm:ss"): DoDateisLeapYear(date: Date | number): booleanisLeapYearJalali(date: Date | number): boolean
methods
getDate(): DategetYear(): numbergetYearJalali(): numbergetMonth(): numbergetMonthJalali(): numbergetDay(): numbergetDayJalali(): numbergetHour(): numbergetMinute(): numbergetSecond(): numberisValid(): booleandayOfWeek(): numberdayOfWeekJalali(): numberdayOfYear(): numberdayOfYearJalali(): numberweekOfYear(): numberweekOfYearJalali(): numberaddDays(days: number): DoDatesubDays(days: number): DoDateaddJalaliDays(days: number): DoDatesubJalaliDays(days: number): DoDateaddMonths(months: number): DoDatesubMonths(months: number): DoDateaddJalaliMonths(months: number): DoDatesubJalaliMonths(months: number): DoDateaddYears(years: number): DoDatesubYears(years: number): DoDateaddJalaliYears(years: number): DoDatesubJalaliYears(years: number): DoDatestartOfMonth(): DoDateendOfMonth(): DoDatestartOfMonthJalali(): DoDateendOfMonthJalali(): DoDateisAfter(date: Date | DoDate, onlyDate: boolean = false): booleanisAfterOrEqual(date: Date | DoDate, onlyDate: boolean = false): booleanisBefore(date: Date | DoDate, onlyDate: boolean = false): booleanisBeforeOrEqual(date: Date | DoDate, onlyDate: boolean = false): booleanisEqual(date: Date | DoDate, onlyDate: boolean = false): booleanformat(pattern: string): stringformatJalali(pattern: string): stringisLeapYear(): booleanisLeapYearJalali(): booleansetYear(year: number): DoDatesetMonth(month: number): DoDatesetDay(day: number): DoDatesetJalaliYear(year: number): DoDatesetJalaliMonth(month: number): DoDatesetJalaliDay(day: number): DoDatesetHour(hour: number): DoDatesetMinute(minute: number): DoDatesetSecond(second: number): DoDatetoString(): stringtoJSON(): string