-
Notifications
You must be signed in to change notification settings - Fork 7
Home
What we need?
Datium is calendar which is designed to be the responsible and smart about what we do with date and time, so we trying to create it step by step by this temporary wiki. this document is not for who want just use datium as a library, it's just for developers on this project.
This method is for add or sub some date/time to created date object, you can add or sub date/time by following structure.
parameter | example |
---|---|
hour | 1 hour |
second | 5 second |
minute | 6 minute |
day | 7 day |
week | 1 week |
month | 4 month |
year | 2 year |
century | 4 century |
Datium::now()->add('1 day')->get(); // if now is Farvardin 14, 1394 00:12:56
Datium::now()->sub('1 day')->get(); // if now is Farvardin 14, 1394 00:12:56
Then the output should be something be equal with this.
Output => Farvardin 15, 1394 00:12:56
Output => Farvardin 13, 1394 00:12:56
This method 'll output the value as some types with can injected to parameters of this method.
This is default get()
method output this is simple shamsi calendar with iran format.
Datium::now()->get(); //ouput -> Farvardin 14, 1394 00:12:56
This methods help developer to do some functionality on his code.
Leap should be independent class and be used in main datium class, this class can work with leap year.
method | description | output |
---|---|---|
isLeapYear() | Determine if current year is leap year | boolean |
nextLeapYear() | Determine when is next leap year | date/time |
lastLeapYaer() | Determine when was last leap year | date/time |
Datium::now()->isLeapYear(); //output -> True or False
Datium::now()->nextLeapYear()->get(); //output -> 1396
Datium::now()->lastLeapYear()->get(); //output -> 1392
There is some functions to determine when is weekend and when is holiday in iran, afghanistan, arabic counties and general world events, this class should be a independent class and called in main datium class.
Specify is today weekend or not.
Datium::now()->isWeekend(); //output -> True or False
Specify When is next weekend.
Datium::now()->nextWeekend()->get();
Specify When was last weekend.
Datium::now()->lastWeekend()->get();
Specify is today holiday or not.
Datium::now()->isHoliday(); //output -> True or False
Specify When is next holiday.
Datium::now()->nextHoliday()->get();
Specify When was last holiday.
Datium::now()->lastHoliday()->get();
Specify what is holiday name with specific parameters.
number | name | description |
---|---|---|
1 | iran | - |
2 | afghanistan | - |
3 | islam | islamic events |
4 | zartousht | zartoustian events |
5 | jodism | jodi events |
6 | global | international events |
Datium::now()->holidayName('iran'); //output string -> nowrooz
This calendar output should be compatible with Iran and Afghanistan Shamsi calendar also should have output in Jalali calendar, this is output month in this 3 calenders.
Month number | Iran | Afghanistan | Season | gregorian |
---|---|---|---|---|
1 | Farvardin - فروردین | Haml - حمل | Spring | 21 March - 20 April |
2 | Ordibehesht - ادیبهشت | Sawr - ثور | Spring | 21 April - 21 May |
3 | khordad - خرداد | Jawza - جوزا | Spring | 22 May - 21 Jun |
4 | Tir - تیر | Saratan - سرطان | Summer | 22 Jun - 22 July |
5 | Mordad - مرداد | Asad - اسد | Summer | 23 July - 22 August |
6 | Shahrivar - شهریور | Sonbole - سنبل | Summer | 23 August - 22 September |
7 | Mehr - مهر | Mizan - میزان | Fall | 23 September - 22 October |
8 | Aban - آبان | Aqrab - عقرب | Fall | 23 October - 21 November |
9 | Azar - آذر | Quws - قوس | Fall | 22 November - 21 December |
10 | Dey - دی | Jadi - جدی | Winter | 22 December - 20 January |
11 | Bahman - بهمن | Dollo - دلو | Winter | 21 January - 19 February |
12 | Esfand - اسفند | Hoot - حوت | Winter | 20 February - 20 March |