Addition & Subtraction
Year 1.0.0+
let p = new PersianDate('1400/2/21','jalali');
p.addYear().toString(); // 1401/02/21
p.subYear().toString(); // 1400/02/21
You can add or subtract the year with a number.
let p = new PersianDate('1400/2/21','jalali');
p.addYear(3).toString(); // 1403/02/21
p.subYear(2).toString(); // 1401/02/21
Month 1.0.0+
let p = new PersianDate('1400/2/21','jalali');
p.addMonth().toString(); // 1400/03/21
p.subMonth().toString(); // 1400/02/21
You can add or subtract the month with a number.
let p = new PersianDate('1400/11/21','jalali');
p.addMonth(3).toString(); // 1401/02/21
p.subMonth(2).toString(); // 1399/12/21
Day 1.0.0+
let p = new PersianDate('1400/2/21','jalali');
p.addDay().toString(); // 1400/02/22
p.subDay().toString(); // 1400/02/21
You can add or subtract the day with a number.
let p = new PersianDate('1400/2/21','jalali');
p.addDay(15).toString(); // 1400/03/05
p.subDay(10).toString(); // 1401/02/26
Quarter 1.0.0+
let p = new PersianDate('1400/2/21','jalali');
p.addQuarter().toString(); // 1400/05/21
p.subQuarter().toString(); // 1400/02/21
You can add or subtract the quarter with a number.
let p = new PersianDate('1400/10/21','jalali');
p.addQuarter(2).toString(); // 1401/04/21
p.subQuarter(1).toString(); // 1401/01/21
Week 1.0.0+
let p = new PersianDate('1400/2/21','jalali');
p.addWeek().toString(); // 1400/02/28
p.subWeek().toString(); // 1400/02/21
You can add or subtract the week with a number.
let p = new PersianDate('1400/12/21','jalali');
p.addWeek(5).toString(); // 1401/01/27
p.subWeek(3).toString(); // 1401/01/06
Hour 1.0.0+
let p = new PersianDate('1400/2/21','jalali');
p.addHour().toString('datetime'); // 1400/02/21 01:00
p.subHour().toString('datetime'); // 1400/02/21 00:00
You can add or subtract the hour with a number.
let p = new PersianDate('1400/2/21','jalali');
p.addHour(36).toString('datetime'); // 1400/02/22 12:00
p.subHour(18).toString('datetime'); // 1400/02/21 18:00
Minute 1.0.0+
let p = new PersianDate('1400/2/21','jalali');
p.addMinute().toString('datetime'); // 1400/02/21 00:01
p.subMinute().toString('datetime'); // 1400/02/21 00:00
You can add or subtract the minute with a number.
let p = new PersianDate('1400/2/21','jalali');
p.addMinute(90).toString('datetime'); // 1400/02/21 01:30
p.subMinute(45).toString('datetime'); // 1400/02/21 00:45
Second 1.0.0+
let p = new PersianDate('1400/2/1 12:30','jalali');
p.addSecond().toString('datetime:ss'); // 1400/02/01 12:30:01
p.subSecond().toString('datetime:ss'); // 1400/02/01 12:30:00
You can add or subtract the second with a number.
let p = new PersianDate('1400/2/1 12:30','jalali');
p.addSecond(130).toString('datetime:ss'); // 1400/02/01 12:32:10
p.subSecond(20).toString('datetime:ss'); // 1400/02/01 12:31:50
Millisecond 1.0.0+
let p = new PersianDate('1400/2/1 12:30:40','jalali');
p.addMillisecond().toString('datetime:ss.c'); // 1400/02/01 12:30:40.1
p.subMillisecond().toString('datetime:ss.c'); // 1400/02/01 12:30:40.0
You can add or subtract the millisecond with a number.
let p = new PersianDate('1400/2/1 12:30:40','jalali');
p.addMillisecond(2200).toString('datetime:ss.c'); // 1400/02/01 12:30:42.200
p.subMillisecond(800).toString('datetime:ss.c'); // 1400/02/01 12:31:41.400