@@ -1,20 +1,20 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | - use OpenCafe\Datium as Datium; |
|
| 3 | + use OpenCafe\Datium as Datium; |
|
| 4 | 4 | |
| 5 | - return [ |
|
| 5 | + return [ |
|
| 6 | 6 | |
| 7 | - 'numbers' => array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'), |
|
| 7 | + 'numbers' => array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'), |
|
| 8 | 8 | |
| 9 | - 'am_time' => 'AM', |
|
| 9 | + 'am_time' => 'AM', |
|
| 10 | 10 | |
| 11 | - 'pm_time' => 'PM', |
|
| 11 | + 'pm_time' => 'PM', |
|
| 12 | 12 | |
| 13 | - 'end_of_days' => array( 'th', 'st', 'nd', 'rd' ), |
|
| 13 | + 'end_of_days' => array( 'th', 'st', 'nd', 'rd' ), |
|
| 14 | 14 | |
| 15 | 15 | |
| 16 | 16 | |
| 17 | - /************************************************************ |
|
| 17 | + /************************************************************ |
|
| 18 | 18 | * Convert to |
| 19 | 19 | ************************************************************ |
| 20 | 20 | * |
@@ -22,11 +22,11 @@ discard block |
||
| 22 | 22 | * |
| 23 | 23 | *\_________________________________________________________/ |
| 24 | 24 | */ |
| 25 | - 'convert_to' => function ($date_time) { |
|
| 25 | + 'convert_to' => function ($date_time) { |
|
| 26 | 26 | |
| 27 | - return null; |
|
| 27 | + return null; |
|
| 28 | 28 | |
| 29 | - }, |
|
| 29 | + }, |
|
| 30 | 30 | |
| 31 | 31 | /************************************************************ |
| 32 | 32 | * Convert From |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | 'December' |
| 88 | 88 | |
| 89 | - ), |
|
| 89 | + ), |
|
| 90 | 90 | |
| 91 | 91 | /************************************************************ |
| 92 | 92 | * Days of Week |
@@ -99,28 +99,28 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | 'days_of_week' => array ( |
| 101 | 101 | |
| 102 | - 'Monday', |
|
| 103 | - 'Tuesday', |
|
| 104 | - 'Wednesday', |
|
| 105 | - 'Thursday', |
|
| 106 | - 'Friday', |
|
| 107 | - 'Saturday', |
|
| 108 | - 'Sunday', |
|
| 102 | + 'Monday', |
|
| 103 | + 'Tuesday', |
|
| 104 | + 'Wednesday', |
|
| 105 | + 'Thursday', |
|
| 106 | + 'Friday', |
|
| 107 | + 'Saturday', |
|
| 108 | + 'Sunday', |
|
| 109 | 109 | ), |
| 110 | 110 | |
| 111 | 111 | |
| 112 | 112 | 'month_days_number' => array( 1 => 31, |
| 113 | - 2 => 28, |
|
| 114 | - 3 => 31, |
|
| 115 | - 4 => 30, |
|
| 116 | - 5 => 31, |
|
| 117 | - 6 => 30, |
|
| 118 | - 7 => 31, |
|
| 119 | - 8 => 31, |
|
| 120 | - 9 => 30, |
|
| 121 | - 10 => 31, |
|
| 122 | - 11 => 30, |
|
| 123 | - 12 => 30 ), |
|
| 113 | + 2 => 28, |
|
| 114 | + 3 => 31, |
|
| 115 | + 4 => 30, |
|
| 116 | + 5 => 31, |
|
| 117 | + 6 => 30, |
|
| 118 | + 7 => 31, |
|
| 119 | + 8 => 31, |
|
| 120 | + 9 => 30, |
|
| 121 | + 10 => 31, |
|
| 122 | + 11 => 30, |
|
| 123 | + 12 => 30 ), |
|
| 124 | 124 | |
| 125 | 125 | |
| 126 | 126 | 'day_of_year' => function ($date_time) { |
@@ -3,9 +3,9 @@ discard block |
||
| 3 | 3 | use OpenCafe\Datium as Datium; |
| 4 | 4 | use OpenCafe\Tools\Leap as Leap; |
| 5 | 5 | |
| 6 | - return array ( |
|
| 6 | + return array ( |
|
| 7 | 7 | |
| 8 | - /************************************************************ |
|
| 8 | + /************************************************************ |
|
| 9 | 9 | * Convert to |
| 10 | 10 | ************************************************************ |
| 11 | 11 | * |
@@ -13,19 +13,19 @@ discard block |
||
| 13 | 13 | * |
| 14 | 14 | *\_________________________________________________________/ |
| 15 | 15 | */ |
| 16 | - 'convert_to' => function ($date_time) { |
|
| 16 | + 'convert_to' => function ($date_time) { |
|
| 17 | 17 | |
| 18 | - $config = include 'Jalali.php'; |
|
| 18 | + $config = include 'Jalali.php'; |
|
| 19 | 19 | |
| 20 | - $date_time = Datium::create($date_time)->to('jalali')->object(); |
|
| 20 | + $date_time = Datium::create($date_time)->to('jalali')->object(); |
|
| 21 | 21 | |
| 22 | - $year = $date_time->format('Y'); |
|
| 22 | + $year = $date_time->format('Y'); |
|
| 23 | 23 | |
| 24 | - $month = $date_time->format('n'); |
|
| 24 | + $month = $date_time->format('n'); |
|
| 25 | 25 | |
| 26 | - $day = $date_time->format('d'); |
|
| 26 | + $day = $date_time->format('d'); |
|
| 27 | 27 | |
| 28 | - $temp_day = 0 ; |
|
| 28 | + $temp_day = 0 ; |
|
| 29 | 29 | |
| 30 | 30 | for ($i = 1; $i < $month; $i++) { |
| 31 | 31 | $temp_day += $config[ 'month_days_number' ][ $i ]; |
@@ -39,13 +39,13 @@ discard block |
||
| 39 | 39 | $temp_day++; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - $_year = ( ( ( ( ( $year - 1 ) * 365.2422 ) + $temp_day ) - 119) / 354.3670 ) + 1; |
|
| 42 | + $_year = ( ( ( ( ( $year - 1 ) * 365.2422 ) + $temp_day ) - 119) / 354.3670 ) + 1; |
|
| 43 | 43 | |
| 44 | - $_year = explode('.', $_year); |
|
| 44 | + $_year = explode('.', $_year); |
|
| 45 | 45 | |
| 46 | - $year = $_year[0]; |
|
| 46 | + $year = $_year[0]; |
|
| 47 | 47 | |
| 48 | - $_month = $_year[1]; |
|
| 48 | + $_month = $_year[1]; |
|
| 49 | 49 | |
| 50 | 50 | $var_temp = '0.0'; |
| 51 | 51 | |
@@ -55,37 +55,37 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | $var_temp .= '1'; |
| 57 | 57 | |
| 58 | - $_month = $_month * $var_temp ; |
|
| 58 | + $_month = $_month * $var_temp ; |
|
| 59 | 59 | |
| 60 | - $_month = ( $_month * 12 ) + 1; |
|
| 60 | + $_month = ( $_month * 12 ) + 1; |
|
| 61 | 61 | |
| 62 | - $_month = explode('.', $_month); |
|
| 62 | + $_month = explode('.', $_month); |
|
| 63 | 63 | |
| 64 | - $month = $_month[0]; |
|
| 64 | + $month = $_month[0]; |
|
| 65 | 65 | |
| 66 | - $_day = $_month[1]; |
|
| 66 | + $_day = $_month[1]; |
|
| 67 | 67 | |
| 68 | - $var_temp = '0.0'; |
|
| 68 | + $var_temp = '0.0'; |
|
| 69 | 69 | |
| 70 | 70 | for ($i = strlen($_day); $i > 2; $i--) { |
| 71 | 71 | $var_temp .= '0' ; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - $var_temp .= '1'; |
|
| 74 | + $var_temp .= '1'; |
|
| 75 | 75 | |
| 76 | - $_day = $_day * $var_temp; |
|
| 76 | + $_day = $_day * $var_temp; |
|
| 77 | 77 | |
| 78 | - $_day = ( $_day * 29.530 ); |
|
| 78 | + $_day = ( $_day * 29.530 ); |
|
| 79 | 79 | |
| 80 | - $_day = explode('.', $_day); |
|
| 80 | + $_day = explode('.', $_day); |
|
| 81 | 81 | |
| 82 | - $day = $_day[0]; |
|
| 82 | + $day = $_day[0]; |
|
| 83 | 83 | |
| 84 | 84 | $date_time->setDate($year, $month, $day); |
| 85 | 85 | |
| 86 | 86 | return $date_time; |
| 87 | 87 | |
| 88 | - }, |
|
| 88 | + }, |
|
| 89 | 89 | |
| 90 | 90 | /************************************************************ |
| 91 | 91 | * Convert From |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | |
| 193 | 193 | 'Dhu al_Hijjah' |
| 194 | 194 | |
| 195 | - ), |
|
| 195 | + ), |
|
| 196 | 196 | |
| 197 | 197 | /************************************************************ |
| 198 | 198 | * Days of Week |
@@ -204,13 +204,13 @@ discard block |
||
| 204 | 204 | *\_________________________________________________________/ |
| 205 | 205 | */ |
| 206 | 206 | 'days_of_week' => array ( |
| 207 | - 'al-Aḥad', |
|
| 208 | - 'al-Ithnayn', |
|
| 209 | - 'ath-Thulatha\'', |
|
| 210 | - 'al-Arbi\'a', |
|
| 211 | - 'al-Khamees', |
|
| 212 | - 'al-Jumu\'ah', |
|
| 213 | - 'as-Sabt', |
|
| 207 | + 'al-Aḥad', |
|
| 208 | + 'al-Ithnayn', |
|
| 209 | + 'ath-Thulatha\'', |
|
| 210 | + 'al-Arbi\'a', |
|
| 211 | + 'al-Khamees', |
|
| 212 | + 'al-Jumu\'ah', |
|
| 213 | + 'as-Sabt', |
|
| 214 | 214 | |
| 215 | 215 | ), |
| 216 | 216 | |
@@ -226,17 +226,17 @@ discard block |
||
| 226 | 226 | |
| 227 | 227 | |
| 228 | 228 | 'month_days_number' => array( 1 => 30, |
| 229 | - 2 => 29, |
|
| 230 | - 3 => 30, |
|
| 231 | - 4 => 30, |
|
| 232 | - 5 => 29, |
|
| 233 | - 6 => 29, |
|
| 234 | - 7 => 30, |
|
| 235 | - 8 => 29, |
|
| 236 | - 9 => 30, |
|
| 237 | - 10 => 29, |
|
| 238 | - 11 => 30, |
|
| 239 | - 12 => 30 ), |
|
| 229 | + 2 => 29, |
|
| 230 | + 3 => 30, |
|
| 231 | + 4 => 30, |
|
| 232 | + 5 => 29, |
|
| 233 | + 6 => 29, |
|
| 234 | + 7 => 30, |
|
| 235 | + 8 => 29, |
|
| 236 | + 9 => 30, |
|
| 237 | + 10 => 29, |
|
| 238 | + 11 => 30, |
|
| 239 | + 12 => 30 ), |
|
| 240 | 240 | /************************************************************ |
| 241 | 241 | * Day of year |
| 242 | 242 | ************************************************************ |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | * |
| 246 | 246 | *\_________________________________________________________/ |
| 247 | 247 | */ |
| 248 | - 'day_of_year' => function ($date_time) { |
|
| 248 | + 'day_of_year' => function ($date_time) { |
|
| 249 | 249 | |
| 250 | 250 | $result = null; |
| 251 | 251 | |
@@ -265,9 +265,9 @@ discard block |
||
| 265 | 265 | |
| 266 | 266 | return $result; |
| 267 | 267 | |
| 268 | - }, |
|
| 268 | + }, |
|
| 269 | 269 | |
| 270 | - /************************************************************ |
|
| 270 | + /************************************************************ |
|
| 271 | 271 | * Day of week |
| 272 | 272 | ************************************************************ |
| 273 | 273 | * |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | * example : al-Aḥad = result is 1 |
| 276 | 276 | *\_________________________________________________________/ |
| 277 | 277 | */ |
| 278 | - 'day_of_week' => function ($date_time) { |
|
| 278 | + 'day_of_week' => function ($date_time) { |
|
| 279 | 279 | |
| 280 | 280 | $configGhamari = include 'Hijri.php'; |
| 281 | 281 | |
@@ -291,9 +291,9 @@ discard block |
||
| 291 | 291 | } |
| 292 | 292 | } |
| 293 | 293 | |
| 294 | - }, |
|
| 294 | + }, |
|
| 295 | 295 | |
| 296 | - /************************************************************ |
|
| 296 | + /************************************************************ |
|
| 297 | 297 | * Leap year |
| 298 | 298 | ************************************************************ |
| 299 | 299 | * |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | * |
| 302 | 302 | *\_________________________________________________________/ |
| 303 | 303 | */ |
| 304 | - 'leap_year' => null, |
|
| 304 | + 'leap_year' => null, |
|
| 305 | 305 | |
| 306 | 306 | /************************************************************ |
| 307 | 307 | * Weekend |