├── src ├── Carbon │ ├── Lang │ │ ├── sr_ME.php │ │ ├── ur.php │ │ ├── mk.php │ │ ├── gl.php │ │ ├── ja.php │ │ ├── zh.php │ │ ├── zh_TW.php │ │ ├── ko.php │ │ ├── hy.php │ │ ├── kk.php │ │ ├── fa.php │ │ ├── uz.php │ │ ├── az.php │ │ ├── cy.php │ │ ├── tr.php │ │ ├── vi.php │ │ ├── ne.php │ │ ├── ka.php │ │ ├── km.php │ │ ├── th.php │ │ ├── id.php │ │ ├── ms.php │ │ ├── hi.php │ │ ├── eu.php │ │ ├── bn.php │ │ ├── sw.php │ │ ├── is.php │ │ ├── gu.php │ │ ├── ps.php │ │ ├── da.php │ │ ├── af.php │ │ ├── sq.php │ │ ├── he.php │ │ ├── pt.php │ │ ├── pt_BR.php │ │ ├── sv.php │ │ ├── fo.php │ │ ├── bg.php │ │ ├── eo.php │ │ ├── el.php │ │ ├── fi.php │ │ ├── dv_MV.php │ │ ├── ro.php │ │ ├── en.php │ │ ├── nl.php │ │ ├── fr.php │ │ ├── ru.php │ │ ├── cs.php │ │ ├── sh.php │ │ ├── uk.php │ │ ├── hr.php │ │ ├── no.php │ │ ├── ca.php │ │ ├── pl.php │ │ ├── bs_BA.php │ │ ├── es.php │ │ ├── it.php │ │ ├── et.php │ │ ├── de.php │ │ ├── ar.php │ │ ├── sk.php │ │ ├── ar_Shakl.php │ │ ├── sr.php │ │ ├── hu.php │ │ ├── lt.php │ │ ├── sr_Cyrl.php │ │ ├── sr_Cyrl_ME.php │ │ ├── sr_Latn_ME.php │ │ ├── lv.php │ │ ├── sl.php │ │ └── mn.php │ ├── Exceptions │ │ └── InvalidDateException.php │ ├── Translator.php │ └── CarbonInterval.php └── JsonSerializable.php ├── LICENSE ├── composer.json ├── .php_cs.dist └── readme.md /src/Carbon/Lang/sr_ME.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return require __DIR__.'/sr_Latn_ME.php'; 13 | -------------------------------------------------------------------------------- /src/JsonSerializable.php: -------------------------------------------------------------------------------- 1 | json_encode, 11 | * which is a value of any type other than a resource. 12 | * 13 | * @since 5.4.0 14 | */ 15 | public function jsonSerialize(); 16 | } 17 | -------------------------------------------------------------------------------- /src/Carbon/Lang/ur.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count سال', 14 | 'month' => ':count ماه', 15 | 'week' => ':count ہفتے', 16 | 'day' => ':count روز', 17 | 'hour' => ':count گھنٹے', 18 | 'minute' => ':count منٹ', 19 | 'second' => ':count سیکنڈ', 20 | 'ago' => ':time پہلے', 21 | 'from_now' => ':time بعد', 22 | 'after' => ':time بعد', 23 | 'before' => ':time پہلے', 24 | ); 25 | -------------------------------------------------------------------------------- /src/Carbon/Lang/mk.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count година|:count години', 14 | 'month' => ':count месец|:count месеци', 15 | 'week' => ':count седмица|:count седмици', 16 | 'day' => ':count ден|:count дена', 17 | 'hour' => ':count час|:count часа', 18 | 'minute' => ':count минута|:count минути', 19 | 'second' => ':count секунда|:count секунди', 20 | 'ago' => 'пред :time', 21 | 'from_now' => ':time од сега', 22 | 'after' => 'по :time', 23 | 'before' => 'пред :time', 24 | ); 25 | -------------------------------------------------------------------------------- /src/Carbon/Lang/gl.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count ano|:count anos', 14 | 'month' => ':count mes|:count meses', 15 | 'week' => ':count semana|:count semanas', 16 | 'day' => ':count día|:count días', 17 | 'hour' => ':count hora|:count horas', 18 | 'minute' => ':count minuto|:count minutos', 19 | 'second' => ':count segundo|:count segundos', 20 | 'ago' => 'fai :time', 21 | 'from_now' => 'dentro de :time', 22 | 'after' => ':time despois', 23 | 'before' => ':time antes', 24 | ); 25 | -------------------------------------------------------------------------------- /src/Carbon/Lang/ja.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count年', 14 | 'y' => ':count年', 15 | 'month' => ':countヶ月', 16 | 'm' => ':countヶ月', 17 | 'week' => ':count週間', 18 | 'w' => ':count週間', 19 | 'day' => ':count日', 20 | 'd' => ':count日', 21 | 'hour' => ':count時間', 22 | 'h' => ':count時間', 23 | 'minute' => ':count分', 24 | 'min' => ':count分', 25 | 'second' => ':count秒', 26 | 's' => ':count秒', 27 | 'ago' => ':time前', 28 | 'from_now' => '今から:time', 29 | 'after' => ':time後', 30 | 'before' => ':time前', 31 | ); 32 | -------------------------------------------------------------------------------- /src/Carbon/Lang/zh.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count年', 14 | 'y' => ':count年', 15 | 'month' => ':count个月', 16 | 'm' => ':count个月', 17 | 'week' => ':count周', 18 | 'w' => ':count周', 19 | 'day' => ':count天', 20 | 'd' => ':count天', 21 | 'hour' => ':count小时', 22 | 'h' => ':count小时', 23 | 'minute' => ':count分钟', 24 | 'min' => ':count分钟', 25 | 'second' => ':count秒', 26 | 's' => ':count秒', 27 | 'ago' => ':time前', 28 | 'from_now' => '距现在:time', 29 | 'after' => ':time后', 30 | 'before' => ':time前', 31 | ); 32 | -------------------------------------------------------------------------------- /src/Carbon/Lang/zh_TW.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count年', 14 | 'y' => ':count年', 15 | 'month' => ':count月', 16 | 'm' => ':count月', 17 | 'week' => ':count週', 18 | 'w' => ':count週', 19 | 'day' => ':count天', 20 | 'd' => ':count天', 21 | 'hour' => ':count小時', 22 | 'h' => ':count小時', 23 | 'minute' => ':count分鐘', 24 | 'min' => ':count分鐘', 25 | 'second' => ':count秒', 26 | 's' => ':count秒', 27 | 'ago' => ':time前', 28 | 'from_now' => '距現在:time', 29 | 'after' => ':time後', 30 | 'before' => ':time前', 31 | ); 32 | -------------------------------------------------------------------------------- /src/Carbon/Lang/ko.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count 년', 14 | 'y' => ':count 년', 15 | 'month' => ':count 개월', 16 | 'm' => ':count 개월', 17 | 'week' => ':count 주일', 18 | 'w' => ':count 주일', 19 | 'day' => ':count 일', 20 | 'd' => ':count 일', 21 | 'hour' => ':count 시간', 22 | 'h' => ':count 시간', 23 | 'minute' => ':count 분', 24 | 'min' => ':count 분', 25 | 'second' => ':count 초', 26 | 's' => ':count 초', 27 | 'ago' => ':time 전', 28 | 'from_now' => ':time 후', 29 | 'after' => ':time 이후', 30 | 'before' => ':time 이전', 31 | ); 32 | -------------------------------------------------------------------------------- /src/Carbon/Lang/hy.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count տարի', 14 | 'y' => ':countտ', 15 | 'month' => ':count ամիս', 16 | 'm' => ':countամ', 17 | 'week' => ':count շաբաթ', 18 | 'w' => ':countշ', 19 | 'day' => ':count օր', 20 | 'd' => ':countօր', 21 | 'hour' => ':count ժամ', 22 | 'h' => ':countժ', 23 | 'minute' => ':count րոպե', 24 | 'min' => ':countր', 25 | 'second' => ':count վարկյան', 26 | 's' => ':countվրկ', 27 | 'ago' => ':time առաջ', 28 | 'from_now' => ':time ներկա պահից', 29 | 'after' => ':time հետո', 30 | 'before' => ':time առաջ', 31 | ); 32 | -------------------------------------------------------------------------------- /src/Carbon/Lang/kk.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * For the full copyright and license information, please view the LICENSE 8 | * file that was distributed with this source code. 9 | */ 10 | return array( 11 | 'year' => ':count жыл', 12 | 'y' => ':count жыл', 13 | 'month' => ':count ай', 14 | 'm' => ':count ай', 15 | 'week' => ':count апта', 16 | 'w' => ':count апта', 17 | 'day' => ':count күн', 18 | 'd' => ':count күн', 19 | 'hour' => ':count сағат', 20 | 'h' => ':count сағат', 21 | 'minute' => ':count минут', 22 | 'min' => ':count минут', 23 | 'second' => ':count секунд', 24 | 's' => ':count секунд', 25 | 'ago' => ':time бұрын', 26 | 'from_now' => ':time кейін', 27 | 'after' => ':time кейін', 28 | 'before' => ':time бұрын', 29 | ); 30 | -------------------------------------------------------------------------------- /src/Carbon/Lang/fa.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count سال', 14 | 'y' => ':count سال', 15 | 'month' => ':count ماه', 16 | 'm' => ':count ماه', 17 | 'week' => ':count هفته', 18 | 'w' => ':count هفته', 19 | 'day' => ':count روز', 20 | 'd' => ':count روز', 21 | 'hour' => ':count ساعت', 22 | 'h' => ':count ساعت', 23 | 'minute' => ':count دقیقه', 24 | 'min' => ':count دقیقه', 25 | 'second' => ':count ثانیه', 26 | 's' => ':count ثانیه', 27 | 'ago' => ':time پیش', 28 | 'from_now' => ':time بعد', 29 | 'after' => ':time پس از', 30 | 'before' => ':time پیش از', 31 | ); 32 | -------------------------------------------------------------------------------- /src/Carbon/Lang/uz.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count yil', 14 | 'y' => ':count yil', 15 | 'month' => ':count oy', 16 | 'm' => ':count oy', 17 | 'week' => ':count hafta', 18 | 'w' => ':count hafta', 19 | 'day' => ':count kun', 20 | 'd' => ':count kun', 21 | 'hour' => ':count soat', 22 | 'h' => ':count soat', 23 | 'minute' => ':count daqiqa', 24 | 'min' => ':count daq', 25 | 'second' => ':count soniya', 26 | 's' => ':count s', 27 | 'ago' => ':time avval', 28 | 'from_now' => ':time dan keyin', 29 | 'after' => ':time keyin', 30 | 'before' => ':time oldin', 31 | ); 32 | -------------------------------------------------------------------------------- /src/Carbon/Lang/az.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count il', 14 | 'y' => ':count il', 15 | 'month' => ':count ay', 16 | 'm' => ':count ay', 17 | 'week' => ':count həftə', 18 | 'w' => ':count həftə', 19 | 'day' => ':count gün', 20 | 'd' => ':count gün', 21 | 'hour' => ':count saat', 22 | 'h' => ':count saat', 23 | 'minute' => ':count dəqiqə', 24 | 'min' => ':count dəqiqə', 25 | 'second' => ':count saniyə', 26 | 's' => ':count saniyə', 27 | 'ago' => ':time əvvəl', 28 | 'from_now' => ':time sonra', 29 | 'after' => ':time sonra', 30 | 'before' => ':time əvvəl', 31 | ); 32 | -------------------------------------------------------------------------------- /src/Carbon/Lang/cy.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * For the full copyright and license information, please view the LICENSE 8 | * file that was distributed with this source code. 9 | */ 10 | return array( 11 | 'year' => '1 flwyddyn|:count blynedd', 12 | 'y' => ':countbl', 13 | 'month' => '1 mis|:count fis', 14 | 'm' => ':countmi', 15 | 'week' => ':count wythnos', 16 | 'w' => ':countw', 17 | 'day' => ':count diwrnod', 18 | 'd' => ':countd', 19 | 'hour' => ':count awr', 20 | 'h' => ':counth', 21 | 'minute' => ':count munud', 22 | 'min' => ':countm', 23 | 'second' => ':count eiliad', 24 | 's' => ':counts', 25 | 'ago' => ':time yn ôl', 26 | 'from_now' => ':time o hyn ymlaen', 27 | 'after' => ':time ar ôl', 28 | 'before' => ':time o\'r blaen', 29 | ); 30 | -------------------------------------------------------------------------------- /src/Carbon/Lang/tr.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count yıl', 14 | 'y' => ':count yıl', 15 | 'month' => ':count ay', 16 | 'm' => ':count ay', 17 | 'week' => ':count hafta', 18 | 'w' => ':count hafta', 19 | 'day' => ':count gün', 20 | 'd' => ':count gün', 21 | 'hour' => ':count saat', 22 | 'h' => ':count saat', 23 | 'minute' => ':count dakika', 24 | 'min' => ':count dakika', 25 | 'second' => ':count saniye', 26 | 's' => ':count saniye', 27 | 'ago' => ':time önce', 28 | 'from_now' => ':time sonra', 29 | 'after' => ':time sonra', 30 | 'before' => ':time önce', 31 | ); 32 | -------------------------------------------------------------------------------- /src/Carbon/Lang/vi.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count năm', 14 | 'y' => ':count năm', 15 | 'month' => ':count tháng', 16 | 'm' => ':count tháng', 17 | 'week' => ':count tuần', 18 | 'w' => ':count tuần', 19 | 'day' => ':count ngày', 20 | 'd' => ':count ngày', 21 | 'hour' => ':count giờ', 22 | 'h' => ':count giờ', 23 | 'minute' => ':count phút', 24 | 'min' => ':count phút', 25 | 'second' => ':count giây', 26 | 's' => ':count giây', 27 | 'ago' => ':time trước', 28 | 'from_now' => ':time từ bây giờ', 29 | 'after' => ':time sau', 30 | 'before' => ':time trước', 31 | ); 32 | -------------------------------------------------------------------------------- /src/Carbon/Lang/ne.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count वर्ष', 14 | 'y' => ':count वर्ष', 15 | 'month' => ':count महिना', 16 | 'm' => ':count महिना', 17 | 'week' => ':count हप्ता', 18 | 'w' => ':count हप्ता', 19 | 'day' => ':count दिन', 20 | 'd' => ':count दिन', 21 | 'hour' => ':count घण्टा', 22 | 'h' => ':count घण्टा', 23 | 'minute' => ':count मिनेट', 24 | 'min' => ':count मिनेट', 25 | 'second' => ':count सेकेण्ड', 26 | 's' => ':count सेकेण्ड', 27 | 'ago' => ':time पहिले', 28 | 'from_now' => ':time देखि', 29 | 'after' => ':time पछि', 30 | 'before' => ':time अघि', 31 | ); 32 | -------------------------------------------------------------------------------- /src/Carbon/Lang/ka.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count წლის', 14 | 'y' => ':count წლის', 15 | 'month' => ':count თვის', 16 | 'm' => ':count თვის', 17 | 'week' => ':count კვირის', 18 | 'w' => ':count კვირის', 19 | 'day' => ':count დღის', 20 | 'd' => ':count დღის', 21 | 'hour' => ':count საათის', 22 | 'h' => ':count საათის', 23 | 'minute' => ':count წუთის', 24 | 'min' => ':count წუთის', 25 | 'second' => ':count წამის', 26 | 's' => ':count წამის', 27 | 'ago' => ':time უკან', 28 | 'from_now' => ':time შემდეგ', 29 | 'after' => ':time შემდეგ', 30 | 'before' => ':time უკან', 31 | ); 32 | -------------------------------------------------------------------------------- /src/Carbon/Lang/km.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count ឆ្នាំ', 14 | 'y' => ':count ឆ្នាំ', 15 | 'month' => ':count ខែ', 16 | 'm' => ':count ខែ', 17 | 'week' => ':count សប្ដាហ៍', 18 | 'w' => ':count សប្ដាហ៍', 19 | 'day' => ':count ថ្ងៃ', 20 | 'd' => ':count ថ្ងៃ', 21 | 'hour' => ':count ម៉ោង', 22 | 'h' => ':count ម៉ោង', 23 | 'minute' => ':count នាទី', 24 | 'min' => ':count នាទី', 25 | 'second' => ':count វិនាទី', 26 | 's' => ':count វិនាទី', 27 | 'ago' => ':timeមុន', 28 | 'from_now' => ':timeពី​ឥឡូវ', 29 | 'after' => 'នៅ​ក្រោយ :time', 30 | 'before' => 'នៅ​មុន :time', 31 | ); 32 | -------------------------------------------------------------------------------- /src/Carbon/Lang/th.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count ปี', 14 | 'y' => ':count ปี', 15 | 'month' => ':count เดือน', 16 | 'm' => ':count เดือน', 17 | 'week' => ':count สัปดาห์', 18 | 'w' => ':count สัปดาห์', 19 | 'day' => ':count วัน', 20 | 'd' => ':count วัน', 21 | 'hour' => ':count ชั่วโมง', 22 | 'h' => ':count ชั่วโมง', 23 | 'minute' => ':count นาที', 24 | 'min' => ':count นาที', 25 | 'second' => ':count วินาที', 26 | 's' => ':count วินาที', 27 | 'ago' => ':timeที่แล้ว', 28 | 'from_now' => ':timeต่อจากนี้', 29 | 'after' => ':timeหลังจากนี้', 30 | 'before' => ':timeก่อน', 31 | ); 32 | -------------------------------------------------------------------------------- /src/Carbon/Lang/id.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count tahun', 14 | 'y' => ':count tahun', 15 | 'month' => ':count bulan', 16 | 'm' => ':count bulan', 17 | 'week' => ':count minggu', 18 | 'w' => ':count minggu', 19 | 'day' => ':count hari', 20 | 'd' => ':count hari', 21 | 'hour' => ':count jam', 22 | 'h' => ':count jam', 23 | 'minute' => ':count menit', 24 | 'min' => ':count menit', 25 | 'second' => ':count detik', 26 | 's' => ':count detik', 27 | 'ago' => ':time yang lalu', 28 | 'from_now' => ':time dari sekarang', 29 | 'after' => ':time setelah', 30 | 'before' => ':time sebelum', 31 | ); 32 | -------------------------------------------------------------------------------- /src/Carbon/Lang/ms.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count tahun', 14 | 'y' => ':count tahun', 15 | 'month' => ':count bulan', 16 | 'm' => ':count bulan', 17 | 'week' => ':count minggu', 18 | 'w' => ':count minggu', 19 | 'day' => ':count hari', 20 | 'd' => ':count hari', 21 | 'hour' => ':count jam', 22 | 'h' => ':count jam', 23 | 'minute' => ':count minit', 24 | 'min' => ':count minit', 25 | 'second' => ':count saat', 26 | 's' => ':count saat', 27 | 'ago' => ':time yang lalu', 28 | 'from_now' => ':time dari sekarang', 29 | 'after' => ':time selepas', 30 | 'before' => ':time sebelum', 31 | ); 32 | -------------------------------------------------------------------------------- /src/Carbon/Lang/hi.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => '1 वर्ष|:count वर्षों', 14 | 'y' => '1 वर्ष|:count वर्षों', 15 | 'month' => '1 माह|:count महीने', 16 | 'm' => '1 माह|:count महीने', 17 | 'week' => '1 सप्ताह|:count सप्ताह', 18 | 'w' => '1 सप्ताह|:count सप्ताह', 19 | 'day' => '1 दिन|:count दिनों', 20 | 'd' => '1 दिन|:count दिनों', 21 | 'hour' => '1 घंटा|:count घंटे', 22 | 'h' => '1 घंटा|:count घंटे', 23 | 'minute' => '1 मिनट|:count मिनटों', 24 | 'min' => '1 मिनट|:count मिनटों', 25 | 'second' => '1 सेकंड|:count सेकंड', 26 | 's' => '1 सेकंड|:count सेकंड', 27 | 'ago' => ':time पूर्व', 28 | 'from_now' => ':time से', 29 | 'after' => ':time के बाद', 30 | 'before' => ':time के पहले', 31 | ); 32 | -------------------------------------------------------------------------------- /src/Carbon/Lang/eu.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => 'Urte 1|:count urte', 14 | 'y' => 'Urte 1|:count urte', 15 | 'month' => 'Hile 1|:count hile', 16 | 'm' => 'Hile 1|:count hile', 17 | 'week' => 'Aste 1|:count aste', 18 | 'w' => 'Aste 1|:count aste', 19 | 'day' => 'Egun 1|:count egun', 20 | 'd' => 'Egun 1|:count egun', 21 | 'hour' => 'Ordu 1|:count ordu', 22 | 'h' => 'Ordu 1|:count ordu', 23 | 'minute' => 'Minutu 1|:count minutu', 24 | 'min' => 'Minutu 1|:count minutu', 25 | 'second' => 'Segundu 1|:count segundu', 26 | 's' => 'Segundu 1|:count segundu', 27 | 'ago' => 'Orain dela :time', 28 | 'from_now' => ':time barru', 29 | 'after' => ':time geroago', 30 | 'before' => ':time lehenago', 31 | ); 32 | -------------------------------------------------------------------------------- /src/Carbon/Lang/bn.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => '১ বছর|:count বছর', 14 | 'y' => '১ বছর|:count বছর', 15 | 'month' => '১ মাস|:count মাস', 16 | 'm' => '১ মাস|:count মাস', 17 | 'week' => '১ সপ্তাহ|:count সপ্তাহ', 18 | 'w' => '১ সপ্তাহ|:count সপ্তাহ', 19 | 'day' => '১ দিন|:count দিন', 20 | 'd' => '১ দিন|:count দিন', 21 | 'hour' => '১ ঘন্টা|:count ঘন্টা', 22 | 'h' => '১ ঘন্টা|:count ঘন্টা', 23 | 'minute' => '১ মিনিট|:count মিনিট', 24 | 'min' => '১ মিনিট|:count মিনিট', 25 | 'second' => '১ সেকেন্ড|:count সেকেন্ড', 26 | 's' => '১ সেকেন্ড|:count সেকেন্ড', 27 | 'ago' => ':time পূর্বে', 28 | 'from_now' => 'এখন থেকে :time', 29 | 'after' => ':time পরে', 30 | 'before' => ':time আগে', 31 | ); 32 | -------------------------------------------------------------------------------- /src/Carbon/Lang/sw.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => 'mwaka 1|miaka :count', 14 | 'y' => 'mwaka 1|miaka :count', 15 | 'month' => 'mwezi 1|miezi :count', 16 | 'm' => 'mwezi 1|miezi :count', 17 | 'week' => 'wiki 1|wiki :count', 18 | 'w' => 'wiki 1|wiki :count', 19 | 'day' => 'siku 1|siku :count', 20 | 'd' => 'siku 1|siku :count', 21 | 'hour' => 'saa 1|masaa :count', 22 | 'h' => 'saa 1|masaa :count', 23 | 'minute' => 'dakika 1|dakika :count', 24 | 'min' => 'dakika 1|dakika :count', 25 | 'second' => 'sekunde 1|sekunde :count', 26 | 's' => 'sekunde 1|sekunde :count', 27 | 'ago' => ':time ziliyopita', 28 | 'from_now' => ':time kwanzia sasa', 29 | 'after' => ':time baada', 30 | 'before' => ':time kabla', 31 | ); 32 | -------------------------------------------------------------------------------- /src/Carbon/Lang/is.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => '1 ár|:count ár', 14 | 'y' => '1 ár|:count ár', 15 | 'month' => '1 mánuður|:count mánuðir', 16 | 'm' => '1 mánuður|:count mánuðir', 17 | 'week' => '1 vika|:count vikur', 18 | 'w' => '1 vika|:count vikur', 19 | 'day' => '1 dagur|:count dagar', 20 | 'd' => '1 dagur|:count dagar', 21 | 'hour' => '1 klukkutími|:count klukkutímar', 22 | 'h' => '1 klukkutími|:count klukkutímar', 23 | 'minute' => '1 mínúta|:count mínútur', 24 | 'min' => '1 mínúta|:count mínútur', 25 | 'second' => '1 sekúnda|:count sekúndur', 26 | 's' => '1 sekúnda|:count sekúndur', 27 | 'ago' => ':time síðan', 28 | 'from_now' => ':time síðan', 29 | 'after' => ':time eftir', 30 | 'before' => ':time fyrir', 31 | ); 32 | -------------------------------------------------------------------------------- /src/Carbon/Lang/gu.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count વર્ષ|:count વર્ષો', 14 | 'y' => ':countવર્ષ|:countવર્ષો', 15 | 'month' => ':count મહિનો|:count મહિના', 16 | 'm' => ':countમહિનો|:countમહિના', 17 | 'week' => ':count અઠવાડિયું|:count અઠવાડિયા', 18 | 'w' => ':countઅઠ.|:countઅઠ.', 19 | 'day' => ':count દિવસ|:count દિવસો', 20 | 'd' => ':countદિ.|:countદિ.', 21 | 'hour' => ':count કલાક|:count કલાકો', 22 | 'h' => ':countક.|:countક.', 23 | 'minute' => ':count મિનિટ|:count મિનિટ', 24 | 'min' => ':countમિ.|:countમિ.', 25 | 'second' => ':count સેકેન્ડ|:count સેકેન્ડ', 26 | 's' => ':countસે.|:countસે.', 27 | 'ago' => ':time પહેલા', 28 | 'from_now' => ':time અત્યારથી', 29 | 'after' => ':time પછી', 30 | 'before' => ':time પહેલા', 31 | ); 32 | -------------------------------------------------------------------------------- /src/Carbon/Lang/ps.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count کال|:count کاله', 14 | 'y' => ':countکال|:countکاله', 15 | 'month' => ':count مياشت|:count مياشتي', 16 | 'm' => ':countمياشت|:countمياشتي', 17 | 'week' => ':count اونۍ|:count اونۍ', 18 | 'w' => ':countاونۍ|:countاونۍ', 19 | 'day' => ':count ورځ|:count ورځي', 20 | 'd' => ':countورځ|:countورځي', 21 | 'hour' => ':count ساعت|:count ساعته', 22 | 'h' => ':countساعت|:countساعته', 23 | 'minute' => ':count دقيقه|:count دقيقې', 24 | 'min' => ':countدقيقه|:countدقيقې', 25 | 'second' => ':count ثانيه|:count ثانيې', 26 | 's' => ':countثانيه|:countثانيې', 27 | 'ago' => ':time دمخه', 28 | 'from_now' => ':time له اوس څخه', 29 | 'after' => ':time وروسته', 30 | 'before' => ':time دمخه', 31 | ); 32 | -------------------------------------------------------------------------------- /src/Carbon/Lang/da.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count år|:count år', 14 | 'y' => ':count år|:count år', 15 | 'month' => ':count måned|:count måneder', 16 | 'm' => ':count måned|:count måneder', 17 | 'week' => ':count uge|:count uger', 18 | 'w' => ':count uge|:count uger', 19 | 'day' => ':count dag|:count dage', 20 | 'd' => ':count dag|:count dage', 21 | 'hour' => ':count time|:count timer', 22 | 'h' => ':count time|:count timer', 23 | 'minute' => ':count minut|:count minutter', 24 | 'min' => ':count minut|:count minutter', 25 | 'second' => ':count sekund|:count sekunder', 26 | 's' => ':count sekund|:count sekunder', 27 | 'ago' => ':time siden', 28 | 'from_now' => 'om :time', 29 | 'after' => ':time efter', 30 | 'before' => ':time før', 31 | ); 32 | -------------------------------------------------------------------------------- /src/Carbon/Lang/af.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count jaar|:count jare', 14 | 'y' => ':count jaar|:count jare', 15 | 'month' => ':count maand|:count maande', 16 | 'm' => ':count maand|:count maande', 17 | 'week' => ':count week|:count weke', 18 | 'w' => ':count week|:count weke', 19 | 'day' => ':count dag|:count dae', 20 | 'd' => ':count dag|:count dae', 21 | 'hour' => ':count uur|:count ure', 22 | 'h' => ':count uur|:count ure', 23 | 'minute' => ':count minuut|:count minute', 24 | 'min' => ':count minuut|:count minute', 25 | 'second' => ':count sekond|:count sekondes', 26 | 's' => ':count sekond|:count sekondes', 27 | 'ago' => ':time terug', 28 | 'from_now' => ':time van nou af', 29 | 'after' => ':time na', 30 | 'before' => ':time voor', 31 | ); 32 | -------------------------------------------------------------------------------- /src/Carbon/Lang/sq.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count vit|:count vjet', 14 | 'y' => ':count vit|:count vjet', 15 | 'month' => ':count muaj|:count muaj', 16 | 'm' => ':count muaj|:count muaj', 17 | 'week' => ':count javë|:count javë', 18 | 'w' => ':count javë|:count javë', 19 | 'day' => ':count ditë|:count ditë', 20 | 'd' => ':count ditë|:count ditë', 21 | 'hour' => ':count orë|:count orë', 22 | 'h' => ':count orë|:count orë', 23 | 'minute' => ':count minutë|:count minuta', 24 | 'min' => ':count minutë|:count minuta', 25 | 'second' => ':count sekondë|:count sekonda', 26 | 's' => ':count sekondë|:count sekonda', 27 | 'ago' => ':time më parë', 28 | 'from_now' => ':time nga tani', 29 | 'after' => ':time pas', 30 | 'before' => ':time para', 31 | ); 32 | -------------------------------------------------------------------------------- /src/Carbon/Lang/he.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => 'שנה|{2}שנתיים|:count שנים', 14 | 'y' => 'שנה|{2}שנתיים|:count שנים', 15 | 'month' => 'חודש|{2}חודשיים|:count חודשים', 16 | 'm' => 'חודש|{2}חודשיים|:count חודשים', 17 | 'week' => 'שבוע|{2}שבועיים|:count שבועות', 18 | 'w' => 'שבוע|{2}שבועיים|:count שבועות', 19 | 'day' => 'יום|{2}יומיים|:count ימים', 20 | 'd' => 'יום|{2}יומיים|:count ימים', 21 | 'hour' => 'שעה|{2}שעתיים|:count שעות', 22 | 'h' => 'שעה|{2}שעתיים|:count שעות', 23 | 'minute' => 'דקה|{2}דקותיים|:count דקות', 24 | 'min' => 'דקה|{2}דקותיים|:count דקות', 25 | 'second' => 'שניה|:count שניות', 26 | 's' => 'שניה|:count שניות', 27 | 'ago' => 'לפני :time', 28 | 'from_now' => 'בעוד :time', 29 | 'after' => 'אחרי :time', 30 | 'before' => 'לפני :time', 31 | ); 32 | -------------------------------------------------------------------------------- /src/Carbon/Lang/pt.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count ano|:count anos', 14 | 'y' => ':count ano|:count anos', 15 | 'month' => ':count mês|:count meses', 16 | 'm' => ':count mês|:count meses', 17 | 'week' => ':count semana|:count semanas', 18 | 'w' => ':count semana|:count semanas', 19 | 'day' => ':count dia|:count dias', 20 | 'd' => ':count dia|:count dias', 21 | 'hour' => ':count hora|:count horas', 22 | 'h' => ':count hora|:count horas', 23 | 'minute' => ':count minuto|:count minutos', 24 | 'min' => ':count minuto|:count minutos', 25 | 'second' => ':count segundo|:count segundos', 26 | 's' => ':count segundo|:count segundos', 27 | 'ago' => ':time atrás', 28 | 'from_now' => 'em :time', 29 | 'after' => ':time depois', 30 | 'before' => ':time antes', 31 | ); 32 | -------------------------------------------------------------------------------- /src/Carbon/Lang/pt_BR.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count ano|:count anos', 14 | 'y' => ':count ano|:count anos', 15 | 'month' => ':count mês|:count meses', 16 | 'm' => ':count mês|:count meses', 17 | 'week' => ':count semana|:count semanas', 18 | 'w' => ':count semana|:count semanas', 19 | 'day' => ':count dia|:count dias', 20 | 'd' => ':count dia|:count dias', 21 | 'hour' => ':count hora|:count horas', 22 | 'h' => ':count hora|:count horas', 23 | 'minute' => ':count minuto|:count minutos', 24 | 'min' => ':count minuto|:count minutos', 25 | 'second' => ':count segundo|:count segundos', 26 | 's' => ':count segundo|:count segundos', 27 | 'ago' => 'há :time', 28 | 'from_now' => 'em :time', 29 | 'after' => 'após :time', 30 | 'before' => ':time atrás', 31 | ); 32 | -------------------------------------------------------------------------------- /src/Carbon/Lang/sv.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count år|:count år', 14 | 'y' => ':count år|:count år', 15 | 'month' => ':count månad|:count månader', 16 | 'm' => ':count månad|:count månader', 17 | 'week' => ':count vecka|:count veckor', 18 | 'w' => ':count vecka|:count veckor', 19 | 'day' => ':count dag|:count dagar', 20 | 'd' => ':count dag|:count dagar', 21 | 'hour' => ':count timme|:count timmar', 22 | 'h' => ':count timme|:count timmar', 23 | 'minute' => ':count minut|:count minuter', 24 | 'min' => ':count minut|:count minuter', 25 | 'second' => ':count sekund|:count sekunder', 26 | 's' => ':count sekund|:count sekunder', 27 | 'ago' => ':time sedan', 28 | 'from_now' => 'om :time', 29 | 'after' => ':time efter', 30 | 'before' => ':time före', 31 | ); 32 | -------------------------------------------------------------------------------- /src/Carbon/Lang/fo.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count ár|:count ár', 14 | 'y' => ':count ár|:count ár', 15 | 'month' => ':count mánaður|:count mánaðir', 16 | 'm' => ':count mánaður|:count mánaðir', 17 | 'week' => ':count vika|:count vikur', 18 | 'w' => ':count vika|:count vikur', 19 | 'day' => ':count dag|:count dagar', 20 | 'd' => ':count dag|:count dagar', 21 | 'hour' => ':count tími|:count tímar', 22 | 'h' => ':count tími|:count tímar', 23 | 'minute' => ':count minutt|:count minuttir', 24 | 'min' => ':count minutt|:count minuttir', 25 | 'second' => ':count sekund|:count sekundir', 26 | 's' => ':count sekund|:count sekundir', 27 | 'ago' => ':time síðan', 28 | 'from_now' => 'um :time', 29 | 'after' => ':time aftaná', 30 | 'before' => ':time áðrenn', 31 | ); 32 | -------------------------------------------------------------------------------- /src/Carbon/Lang/bg.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count година|:count години', 14 | 'y' => ':count година|:count години', 15 | 'month' => ':count месец|:count месеца', 16 | 'm' => ':count месец|:count месеца', 17 | 'week' => ':count седмица|:count седмици', 18 | 'w' => ':count седмица|:count седмици', 19 | 'day' => ':count ден|:count дни', 20 | 'd' => ':count ден|:count дни', 21 | 'hour' => ':count час|:count часа', 22 | 'h' => ':count час|:count часа', 23 | 'minute' => ':count минута|:count минути', 24 | 'min' => ':count минута|:count минути', 25 | 'second' => ':count секунда|:count секунди', 26 | 's' => ':count секунда|:count секунди', 27 | 'ago' => 'преди :time', 28 | 'from_now' => ':time от сега', 29 | 'after' => 'след :time', 30 | 'before' => 'преди :time', 31 | ); 32 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) Brian Nesbitt 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is furnished 8 | to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /src/Carbon/Lang/eo.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count jaro|:count jaroj', 14 | 'y' => ':count jaro|:count jaroj', 15 | 'month' => ':count monato|:count monatoj', 16 | 'm' => ':count monato|:count monatoj', 17 | 'week' => ':count semajno|:count semajnoj', 18 | 'w' => ':count semajno|:count semajnoj', 19 | 'day' => ':count tago|:count tagoj', 20 | 'd' => ':count tago|:count tagoj', 21 | 'hour' => ':count horo|:count horoj', 22 | 'h' => ':count horo|:count horoj', 23 | 'minute' => ':count minuto|:count minutoj', 24 | 'min' => ':count minuto|:count minutoj', 25 | 'second' => ':count sekundo|:count sekundoj', 26 | 's' => ':count sekundo|:count sekundoj', 27 | 'ago' => 'antaŭ :time', 28 | 'from_now' => 'je :time', 29 | 'after' => ':time poste', 30 | 'before' => ':time antaŭe', 31 | ); 32 | -------------------------------------------------------------------------------- /src/Carbon/Lang/el.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count χρόνος|:count χρόνια', 14 | 'y' => ':count χρόνος|:count χρόνια', 15 | 'month' => ':count μήνας|:count μήνες', 16 | 'm' => ':count μήνας|:count μήνες', 17 | 'week' => ':count εβδομάδα|:count εβδομάδες', 18 | 'w' => ':count εβδομάδα|:count εβδομάδες', 19 | 'day' => ':count μέρα|:count μέρες', 20 | 'd' => ':count μέρα|:count μέρες', 21 | 'hour' => ':count ώρα|:count ώρες', 22 | 'h' => ':count ώρα|:count ώρες', 23 | 'minute' => ':count λεπτό|:count λεπτά', 24 | 'min' => ':count λεπτό|:count λεπτά', 25 | 'second' => ':count δευτερόλεπτο|:count δευτερόλεπτα', 26 | 's' => ':count δευτερόλεπτο|:count δευτερόλεπτα', 27 | 'ago' => 'πριν από :time', 28 | 'from_now' => 'σε :time από τώρα', 29 | 'after' => ':time μετά', 30 | 'before' => ':time πριν', 31 | ); 32 | -------------------------------------------------------------------------------- /src/Carbon/Lang/fi.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count vuosi|:count vuotta', 14 | 'y' => ':count vuosi|:count vuotta', 15 | 'month' => ':count kuukausi|:count kuukautta', 16 | 'm' => ':count kuukausi|:count kuukautta', 17 | 'week' => ':count viikko|:count viikkoa', 18 | 'w' => ':count viikko|:count viikkoa', 19 | 'day' => ':count päivä|:count päivää', 20 | 'd' => ':count päivä|:count päivää', 21 | 'hour' => ':count tunti|:count tuntia', 22 | 'h' => ':count tunti|:count tuntia', 23 | 'minute' => ':count minuutti|:count minuuttia', 24 | 'min' => ':count minuutti|:count minuuttia', 25 | 'second' => ':count sekunti|:count sekuntia', 26 | 's' => ':count sekunti|:count sekuntia', 27 | 'ago' => ':time sitten', 28 | 'from_now' => ':time tästä hetkestä', 29 | 'after' => ':time sen jälkeen', 30 | 'before' => ':time ennen', 31 | ); 32 | -------------------------------------------------------------------------------- /src/Carbon/Lang/dv_MV.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => '{0}އަހަރެއް|[1,Inf]:count އަހަރު', 14 | 'y' => '{0}އަހަރެއް|[1,Inf]:count އަހަރު', 15 | 'month' => '{0}މައްސަރެއް|[1,Inf]:count މަސް', 16 | 'm' => '{0}މައްސަރެއް|[1,Inf]:count މަސް', 17 | 'week' => '{0}ހަފްތާއެއް|[1,Inf]:count ހަފްތާ', 18 | 'w' => '{0}ހަފްތާއެއް|[1,Inf]:count ހަފްތާ', 19 | 'day' => '{0}ދުވަސް|[1,Inf]:count ދުވަސް', 20 | 'd' => '{0}ދުވަސް|[1,Inf]:count ދުވަސް', 21 | 'hour' => '{0}ގަޑިއިރެއް|[1,Inf]:count ގަޑި', 22 | 'h' => '{0}ގަޑިއިރެއް|[1,Inf]:count ގަޑި', 23 | 'minute' => '{0}މިނެޓެއް|[1,Inf]:count މިނެޓް', 24 | 'min' => '{0}މިނެޓެއް|[1,Inf]:count މިނެޓް', 25 | 'second' => '{0}ސިކުންތެއް|[1,Inf]:count ސިކުންތު', 26 | 's' => '{0}ސިކުންތެއް|[1,Inf]:count ސިކުންތު', 27 | 'ago' => ':time ކުރިން', 28 | 'from_now' => ':time ފަހުން', 29 | 'after' => ':time ފަހުން', 30 | 'before' => ':time ކުރި', 31 | ); 32 | -------------------------------------------------------------------------------- /src/Carbon/Lang/ro.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => 'un an|:count ani|:count ani', 14 | 'y' => 'un an|:count ani|:count ani', 15 | 'month' => 'o lună|:count luni|:count luni', 16 | 'm' => 'o lună|:count luni|:count luni', 17 | 'week' => 'o săptămână|:count săptămâni|:count săptămâni', 18 | 'w' => 'o săptămână|:count săptămâni|:count săptămâni', 19 | 'day' => 'o zi|:count zile|:count zile', 20 | 'd' => 'o zi|:count zile|:count zile', 21 | 'hour' => 'o oră|:count ore|:count ore', 22 | 'h' => 'o oră|:count ore|:count ore', 23 | 'minute' => 'un minut|:count minute|:count minute', 24 | 'min' => 'un minut|:count minute|:count minute', 25 | 'second' => 'o secundă|:count secunde|:count secunde', 26 | 's' => 'o secundă|:count secunde|:count secunde', 27 | 'ago' => 'acum :time', 28 | 'from_now' => ':time de acum', 29 | 'after' => 'peste :time', 30 | 'before' => 'acum :time', 31 | ); 32 | -------------------------------------------------------------------------------- /src/Carbon/Lang/en.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count year|:count years', 14 | 'y' => ':countyr|:countyrs', 15 | 'month' => ':count month|:count months', 16 | 'm' => ':countmo|:countmos', 17 | 'week' => ':count week|:count weeks', 18 | 'w' => ':countw|:countw', 19 | 'day' => ':count day|:count days', 20 | 'd' => ':countd|:countd', 21 | 'hour' => ':count hour|:count hours', 22 | 'h' => ':counth|:counth', 23 | 'minute' => ':count minute|:count minutes', 24 | 'min' => ':countm|:countm', 25 | 'second' => ':count second|:count seconds', 26 | 's' => ':counts|:counts', 27 | 'ago' => ':time ago', 28 | 'from_now' => ':time from now', 29 | 'after' => ':time after', 30 | 'before' => ':time before', 31 | 'diff_now' => 'just now', 32 | 'diff_yesterday' => 'yesterday', 33 | 'diff_tomorrow' => 'tomorrow', 34 | 'diff_before_yesterday' => 'before yesterday', 35 | 'diff_after_tomorrow' => 'after tomorrow', 36 | ); 37 | -------------------------------------------------------------------------------- /src/Carbon/Lang/nl.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count jaar', 14 | 'y' => ':count jaar', 15 | 'month' => ':count maand|:count maanden', 16 | 'm' => ':count maand|:count maanden', 17 | 'week' => ':count week|:count weken', 18 | 'w' => ':count week|:count weken', 19 | 'day' => ':count dag|:count dagen', 20 | 'd' => ':count dag|:count dagen', 21 | 'hour' => ':count uur', 22 | 'h' => ':count uur', 23 | 'minute' => ':count minuut|:count minuten', 24 | 'min' => ':count minuut|:count minuten', 25 | 'second' => ':count seconde|:count seconden', 26 | 's' => ':count seconde|:count seconden', 27 | 'ago' => ':time geleden', 28 | 'from_now' => 'over :time', 29 | 'after' => ':time later', 30 | 'before' => ':time eerder', 31 | 'diff_now' => 'nu', 32 | 'diff_yesterday' => 'gisteren', 33 | 'diff_tomorrow' => 'morgen', 34 | 'diff_after_tomorrow' => 'overmorgen', 35 | 'diff_before_yesterday' => 'eergisteren', 36 | ); 37 | -------------------------------------------------------------------------------- /src/Carbon/Lang/fr.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count an|:count ans', 14 | 'y' => ':count an|:count ans', 15 | 'month' => ':count mois', 16 | 'm' => ':count mois', 17 | 'week' => ':count semaine|:count semaines', 18 | 'w' => ':count sem.|:count sem.', 19 | 'day' => ':count jour|:count jours', 20 | 'd' => ':count j.|:count j.', 21 | 'hour' => ':count heure|:count heures', 22 | 'h' => ':count h|:count h.', 23 | 'minute' => ':count minute|:count minutes', 24 | 'min' => ':count min.|:count min.', 25 | 'second' => ':count seconde|:count secondes', 26 | 's' => ':count sec.|:count sec.', 27 | 'ago' => 'il y a :time', 28 | 'from_now' => 'dans :time', 29 | 'after' => ':time après', 30 | 'before' => ':time avant', 31 | 'diff_now' => "à l'instant", 32 | 'diff_yesterday' => 'hier', 33 | 'diff_tomorrow' => 'demain', 34 | 'diff_before_yesterday' => 'avant-hier', 35 | 'diff_after_tomorrow' => 'après-demain', 36 | ); 37 | -------------------------------------------------------------------------------- /src/Carbon/Lang/ru.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count год|:count года|:count лет', 14 | 'y' => ':count год|:count года|:count лет', 15 | 'month' => ':count месяц|:count месяца|:count месяцев', 16 | 'm' => ':count месяц|:count месяца|:count месяцев', 17 | 'week' => ':count неделю|:count недели|:count недель', 18 | 'w' => ':count неделю|:count недели|:count недель', 19 | 'day' => ':count день|:count дня|:count дней', 20 | 'd' => ':count день|:count дня|:count дней', 21 | 'hour' => ':count час|:count часа|:count часов', 22 | 'h' => ':count час|:count часа|:count часов', 23 | 'minute' => ':count минуту|:count минуты|:count минут', 24 | 'min' => ':count минуту|:count минуты|:count минут', 25 | 'second' => ':count секунду|:count секунды|:count секунд', 26 | 's' => ':count секунду|:count секунды|:count секунд', 27 | 'ago' => ':time назад', 28 | 'from_now' => 'через :time', 29 | 'after' => ':time после', 30 | 'before' => ':time до', 31 | ); 32 | -------------------------------------------------------------------------------- /src/Carbon/Lang/cs.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count rok|:count roky|:count let', 14 | 'y' => ':count rok|:count roky|:count let', 15 | 'month' => ':count měsíc|:count měsíce|:count měsíců', 16 | 'm' => ':count měsíc|:count měsíce|:count měsíců', 17 | 'week' => ':count týden|:count týdny|:count týdnů', 18 | 'w' => ':count týden|:count týdny|:count týdnů', 19 | 'day' => ':count den|:count dny|:count dní', 20 | 'd' => ':count den|:count dny|:count dní', 21 | 'hour' => ':count hodinu|:count hodiny|:count hodin', 22 | 'h' => ':count hodinu|:count hodiny|:count hodin', 23 | 'minute' => ':count minutu|:count minuty|:count minut', 24 | 'min' => ':count minutu|:count minuty|:count minut', 25 | 'second' => ':count sekundu|:count sekundy|:count sekund', 26 | 's' => ':count sekundu|:count sekundy|:count sekund', 27 | 'ago' => ':time nazpět', 28 | 'from_now' => 'za :time', 29 | 'after' => ':time později', 30 | 'before' => ':time předtím', 31 | ); 32 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "carbondate/carbon", 3 | "type": "library", 4 | "description": "A simple API extension for DateTime.", 5 | "keywords": [ 6 | "date", 7 | "time", 8 | "DateTime" 9 | ], 10 | "homepage": "https://carbondate.github.io", 11 | "license": "MIT", 12 | "require": { 13 | "php": ">=5.3.9", 14 | "symfony/translation": "~2.6 || ~3.0 || ~4.0" 15 | }, 16 | "require-dev": { 17 | "friendsofphp/php-cs-fixer": "^2.0", 18 | "phpunit/phpunit": "^4.8.36 || ^5.7.26 || ^6.0" 19 | }, 20 | "autoload": { 21 | "psr-4": { 22 | "Carbon\\": "src/Carbon/" 23 | } 24 | }, 25 | "autoload-dev": { 26 | "psr-4": { 27 | "Tests\\": "tests/" 28 | } 29 | }, 30 | "config": { 31 | "sort-packages": true 32 | }, 33 | "replace": { 34 | "nesbot/carbon": "*" 35 | }, 36 | "scripts": { 37 | "test": [ 38 | "@phpunit", 39 | "@phpcs" 40 | ], 41 | "phpunit": "phpunit --verbose --coverage-clover=coverage.xml", 42 | "phpcs": "php-cs-fixer fix -v --diff --dry-run", 43 | "phpstan": "phpstan analyse --configuration phpstan.neon --level 3 src tests" 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/Carbon/Lang/sh.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count godina|:count godine|:count godina', 14 | 'y' => ':count godina|:count godine|:count godina', 15 | 'month' => ':count mesec|:count meseca|:count meseci', 16 | 'm' => ':count mesec|:count meseca|:count meseci', 17 | 'week' => ':count nedelja|:count nedelje|:count nedelja', 18 | 'w' => ':count nedelja|:count nedelje|:count nedelja', 19 | 'day' => ':count dan|:count dana|:count dana', 20 | 'd' => ':count dan|:count dana|:count dana', 21 | 'hour' => ':count čas|:count časa|:count časova', 22 | 'h' => ':count čas|:count časa|:count časova', 23 | 'minute' => ':count minut|:count minuta|:count minuta', 24 | 'min' => ':count minut|:count minuta|:count minuta', 25 | 'second' => ':count sekund|:count sekunda|:count sekundi', 26 | 's' => ':count sekund|:count sekunda|:count sekundi', 27 | 'ago' => 'pre :time', 28 | 'from_now' => 'za :time', 29 | 'after' => 'nakon :time', 30 | 'before' => ':time raniјe', 31 | ); 32 | -------------------------------------------------------------------------------- /src/Carbon/Lang/uk.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count рік|:count роки|:count років', 14 | 'y' => ':count рік|:count роки|:count років', 15 | 'month' => ':count місяць|:count місяці|:count місяців', 16 | 'm' => ':count місяць|:count місяці|:count місяців', 17 | 'week' => ':count тиждень|:count тижні|:count тижнів', 18 | 'w' => ':count тиждень|:count тижні|:count тижнів', 19 | 'day' => ':count день|:count дні|:count днів', 20 | 'd' => ':count день|:count дні|:count днів', 21 | 'hour' => ':count година|:count години|:count годин', 22 | 'h' => ':count година|:count години|:count годин', 23 | 'minute' => ':count хвилину|:count хвилини|:count хвилин', 24 | 'min' => ':count хвилину|:count хвилини|:count хвилин', 25 | 'second' => ':count секунду|:count секунди|:count секунд', 26 | 's' => ':count секунду|:count секунди|:count секунд', 27 | 'ago' => ':time тому', 28 | 'from_now' => 'через :time', 29 | 'after' => ':time після', 30 | 'before' => ':time до', 31 | ); 32 | -------------------------------------------------------------------------------- /src/Carbon/Lang/hr.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count godinu|:count godine|:count godina', 14 | 'y' => ':count godinu|:count godine|:count godina', 15 | 'month' => ':count mjesec|:count mjeseca|:count mjeseci', 16 | 'm' => ':count mjesec|:count mjeseca|:count mjeseci', 17 | 'week' => ':count tjedan|:count tjedna|:count tjedana', 18 | 'w' => ':count tjedan|:count tjedna|:count tjedana', 19 | 'day' => ':count dan|:count dana|:count dana', 20 | 'd' => ':count dan|:count dana|:count dana', 21 | 'hour' => ':count sat|:count sata|:count sati', 22 | 'h' => ':count sat|:count sata|:count sati', 23 | 'minute' => ':count minutu|:count minute |:count minuta', 24 | 'min' => ':count minutu|:count minute |:count minuta', 25 | 'second' => ':count sekundu|:count sekunde|:count sekundi', 26 | 's' => ':count sekundu|:count sekunde|:count sekundi', 27 | 'ago' => 'prije :time', 28 | 'from_now' => 'za :time', 29 | 'after' => 'za :time', 30 | 'before' => 'prije :time', 31 | ); 32 | -------------------------------------------------------------------------------- /src/Carbon/Lang/no.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count år|:count år', 14 | 'y' => ':count år|:count år', 15 | 'month' => ':count måned|:count måneder', 16 | 'm' => ':count måned|:count måneder', 17 | 'week' => ':count uke|:count uker', 18 | 'w' => ':count uke|:count uker', 19 | 'day' => ':count dag|:count dager', 20 | 'd' => ':count dag|:count dager', 21 | 'hour' => ':count time|:count timer', 22 | 'h' => ':count time|:count timer', 23 | 'minute' => ':count minutt|:count minutter', 24 | 'min' => ':count minutt|:count minutter', 25 | 'second' => ':count sekund|:count sekunder', 26 | 's' => ':count sekund|:count sekunder', 27 | 'ago' => ':time siden', 28 | 'from_now' => 'om :time', 29 | 'after' => ':time etter', 30 | 'before' => ':time før', 31 | 'diff_now' => 'akkurat nå', 32 | 'diff_yesterday' => 'i går', 33 | 'diff_tomorrow' => 'i morgen', 34 | 'diff_before_yesterday' => 'i forgårs', 35 | 'diff_after_tomorrow' => 'i overmorgen', 36 | ); 37 | -------------------------------------------------------------------------------- /src/Carbon/Lang/ca.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count any|:count anys', 14 | 'y' => ':count any|:count anys', 15 | 'month' => ':count mes|:count mesos', 16 | 'm' => ':count mes|:count mesos', 17 | 'week' => ':count setmana|:count setmanes', 18 | 'w' => ':count setmana|:count setmanes', 19 | 'day' => ':count dia|:count dies', 20 | 'd' => ':count dia|:count dies', 21 | 'hour' => ':count hora|:count hores', 22 | 'h' => ':count hora|:count hores', 23 | 'minute' => ':count minut|:count minuts', 24 | 'min' => ':count minut|:count minuts', 25 | 'second' => ':count segon|:count segons', 26 | 's' => ':count segon|:count segons', 27 | 'ago' => 'fa :time', 28 | 'from_now' => 'dins de :time', 29 | 'after' => ':time després', 30 | 'before' => ':time abans', 31 | 'diff_now' => 'ara mateix', 32 | 'diff_yesterday' => 'ahir', 33 | 'diff_tomorrow' => 'demà', 34 | 'diff_before_yesterday' => "abans d'ahir", 35 | 'diff_after_tomorrow' => 'demà passat', 36 | ); 37 | -------------------------------------------------------------------------------- /src/Carbon/Lang/pl.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count rok|:count lata|:count lat', 14 | 'y' => ':countr|:countl', 15 | 'month' => ':count miesiąc|:count miesiące|:count miesięcy', 16 | 'm' => ':countmies', 17 | 'week' => ':count tydzień|:count tygodnie|:count tygodni', 18 | 'w' => ':counttyg', 19 | 'day' => ':count dzień|:count dni|:count dni', 20 | 'd' => ':countd', 21 | 'hour' => ':count godzina|:count godziny|:count godzin', 22 | 'h' => ':countg', 23 | 'minute' => ':count minuta|:count minuty|:count minut', 24 | 'min' => ':countm', 25 | 'second' => ':count sekunda|:count sekundy|:count sekund', 26 | 's' => ':counts', 27 | 'ago' => ':time temu', 28 | 'from_now' => ':time od teraz', 29 | 'after' => ':time po', 30 | 'before' => ':time przed', 31 | 'diff_now' => 'przed chwilą', 32 | 'diff_yesterday' => 'wczoraj', 33 | 'diff_tomorrow' => 'jutro', 34 | 'diff_before_yesterday' => 'przedwczoraj', 35 | 'diff_after_tomorrow' => 'pojutrze', 36 | ); 37 | -------------------------------------------------------------------------------- /src/Carbon/Lang/bs_BA.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count godina|:count godine|:count godina', 14 | 'y' => ':count godina|:count godine|:count godina', 15 | 'month' => ':count mjesec|:count mjeseca|:count mjeseci', 16 | 'm' => ':count mjesec|:count mjeseca|:count mjeseci', 17 | 'week' => ':count nedjelja|:count nedjelje|:count nedjelja', 18 | 'w' => ':count nedjelja|:count nedjelje|:count nedjelja', 19 | 'day' => ':count dan|:count dana|:count dana', 20 | 'd' => ':count dan|:count dana|:count dana', 21 | 'hour' => ':count sat|:count sata|:count sati', 22 | 'h' => ':count sat|:count sata|:count sati', 23 | 'minute' => ':count minut|:count minuta|:count minuta', 24 | 'min' => ':count minut|:count minuta|:count minuta', 25 | 'second' => ':count sekund|:count sekunda|:count sekundi', 26 | 's' => ':count sekund|:count sekunda|:count sekundi', 27 | 'ago' => 'prije :time', 28 | 'from_now' => 'za :time', 29 | 'after' => 'nakon :time', 30 | 'before' => ':time ranije', 31 | ); 32 | -------------------------------------------------------------------------------- /src/Carbon/Lang/es.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count año|:count años', 14 | 'y' => ':count año|:count años', 15 | 'month' => ':count mes|:count meses', 16 | 'm' => ':count mes|:count meses', 17 | 'week' => ':count semana|:count semanas', 18 | 'w' => ':count semana|:count semanas', 19 | 'day' => ':count día|:count días', 20 | 'd' => ':count día|:count días', 21 | 'hour' => ':count hora|:count horas', 22 | 'h' => ':count hora|:count horas', 23 | 'minute' => ':count minuto|:count minutos', 24 | 'min' => ':count minuto|:count minutos', 25 | 'second' => ':count segundo|:count segundos', 26 | 's' => ':count segundo|:count segundos', 27 | 'ago' => 'hace :time', 28 | 'from_now' => 'dentro de :time', 29 | 'after' => ':time después', 30 | 'before' => ':time antes', 31 | 'diff_now' => 'ahora mismo', 32 | 'diff_yesterday' => 'ayer', 33 | 'diff_tomorrow' => 'mañana', 34 | 'diff_before_yesterday' => 'anteayer', 35 | 'diff_after_tomorrow' => 'pasado mañana', 36 | ); 37 | -------------------------------------------------------------------------------- /src/Carbon/Lang/it.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count anno|:count anni', 14 | 'y' => ':count anno|:count anni', 15 | 'month' => ':count mese|:count mesi', 16 | 'm' => ':count mese|:count mesi', 17 | 'week' => ':count settimana|:count settimane', 18 | 'w' => ':count settimana|:count settimane', 19 | 'day' => ':count giorno|:count giorni', 20 | 'd' => ':count giorno|:count giorni', 21 | 'hour' => ':count ora|:count ore', 22 | 'h' => ':count ora|:count ore', 23 | 'minute' => ':count minuto|:count minuti', 24 | 'min' => ':count minuto|:count minuti', 25 | 'second' => ':count secondo|:count secondi', 26 | 's' => ':count secondo|:count secondi', 27 | 'ago' => ':time fa', 28 | 'from_now' => 'tra :time', 29 | 'after' => ':time dopo', 30 | 'before' => ':time prima', 31 | 'diff_now' => 'proprio ora', 32 | 'diff_yesterday' => 'ieri', 33 | 'diff_tomorrow' => 'domani', 34 | 'diff_before_yesterday' => "l'altro ieri", 35 | 'diff_after_tomorrow' => 'dopodomani', 36 | ); 37 | -------------------------------------------------------------------------------- /src/Carbon/Lang/et.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count aasta|:count aastat', 14 | 'y' => ':count aasta|:count aastat', 15 | 'month' => ':count kuu|:count kuud', 16 | 'm' => ':count kuu|:count kuud', 17 | 'week' => ':count nädal|:count nädalat', 18 | 'w' => ':count nädal|:count nädalat', 19 | 'day' => ':count päev|:count päeva', 20 | 'd' => ':count päev|:count päeva', 21 | 'hour' => ':count tund|:count tundi', 22 | 'h' => ':count tund|:count tundi', 23 | 'minute' => ':count minut|:count minutit', 24 | 'min' => ':count minut|:count minutit', 25 | 'second' => ':count sekund|:count sekundit', 26 | 's' => ':count sekund|:count sekundit', 27 | 'ago' => ':time tagasi', 28 | 'from_now' => ':time pärast', 29 | 'after' => ':time pärast', 30 | 'before' => ':time enne', 31 | 'year_from_now' => ':count aasta', 32 | 'month_from_now' => ':count kuu', 33 | 'week_from_now' => ':count nädala', 34 | 'day_from_now' => ':count päeva', 35 | 'hour_from_now' => ':count tunni', 36 | 'minute_from_now' => ':count minuti', 37 | 'second_from_now' => ':count sekundi', 38 | ); 39 | -------------------------------------------------------------------------------- /src/Carbon/Lang/de.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count Jahr|:count Jahre', 14 | 'y' => ':countJ|:countJ', 15 | 'month' => ':count Monat|:count Monate', 16 | 'm' => ':countMon|:countMon', 17 | 'week' => ':count Woche|:count Wochen', 18 | 'w' => ':countWo|:countWo', 19 | 'day' => ':count Tag|:count Tage', 20 | 'd' => ':countTg|:countTg', 21 | 'hour' => ':count Stunde|:count Stunden', 22 | 'h' => ':countStd|:countStd', 23 | 'minute' => ':count Minute|:count Minuten', 24 | 'min' => ':countMin|:countMin', 25 | 'second' => ':count Sekunde|:count Sekunden', 26 | 's' => ':countSek|:countSek', 27 | 'ago' => 'vor :time', 28 | 'from_now' => 'in :time', 29 | 'after' => ':time später', 30 | 'before' => ':time zuvor', 31 | 32 | 'year_from_now' => ':count Jahr|:count Jahren', 33 | 'month_from_now' => ':count Monat|:count Monaten', 34 | 'week_from_now' => ':count Woche|:count Wochen', 35 | 'day_from_now' => ':count Tag|:count Tagen', 36 | 'year_ago' => ':count Jahr|:count Jahren', 37 | 'month_ago' => ':count Monat|:count Monaten', 38 | 'week_ago' => ':count Woche|:count Wochen', 39 | 'day_ago' => ':count Tag|:count Tagen', 40 | ); 41 | -------------------------------------------------------------------------------- /src/Carbon/Lang/ar.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => '{0}سنة|{1}سنة|{2}سنتين|[3,10]:count سنوات|[11,Inf]:count سنة', 14 | 'y' => '{0}سنة|{1}سنة|{2}سنتين|[3,10]:count سنوات|[11,Inf]:count سنة', 15 | 'month' => '{0}شهر|{1} شهر|{2}شهرين|[3,10]:count أشهر|[11,Inf]:count شهر', 16 | 'm' => '{0}شهر|{1} شهر|{2}شهرين|[3,10]:count أشهر|[11,Inf]:count شهر', 17 | 'week' => '{0}أسبوع|{1}أسبوع|{2}أسبوعين|[3,10]:count أسابيع|[11,Inf]:count أسبوع', 18 | 'w' => '{0}أسبوع|{1}أسبوع|{2}أسبوعين|[3,10]:count أسابيع|[11,Inf]:count أسبوع', 19 | 'day' => '{0}يوم|{1}يوم|{2}يومين|[3,10]:count أيام|[11,Inf] يوم', 20 | 'd' => '{0}يوم|{1}يوم|{2}يومين|[3,10]:count أيام|[11,Inf] يوم', 21 | 'hour' => '{0}ساعة|{1}ساعة|{2}ساعتين|[3,10]:count ساعات|[11,Inf]:count ساعة', 22 | 'h' => '{0}ساعة|{1}ساعة|{2}ساعتين|[3,10]:count ساعات|[11,Inf]:count ساعة', 23 | 'minute' => '{0}دقيقة|{1}دقيقة|{2}دقيقتين|[3,10]:count دقائق|[11,Inf]:count دقيقة', 24 | 'min' => '{0}دقيقة|{1}دقيقة|{2}دقيقتين|[3,10]:count دقائق|[11,Inf]:count دقيقة', 25 | 'second' => '{0}ثانية|{1}ثانية|{2}ثانيتين|[3,10]:count ثوان|[11,Inf]:count ثانية', 26 | 's' => '{0}ثانية|{1}ثانية|{2}ثانيتين|[3,10]:count ثوان|[11,Inf]:count ثانية', 27 | 'ago' => 'منذ :time', 28 | 'from_now' => ':time من الآن', 29 | 'after' => 'بعد :time', 30 | 'before' => 'قبل :time', 31 | ); 32 | -------------------------------------------------------------------------------- /src/Carbon/Exceptions/InvalidDateException.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Carbon\Exceptions; 13 | 14 | use Exception; 15 | use InvalidArgumentException; 16 | 17 | class InvalidDateException extends InvalidArgumentException 18 | { 19 | /** 20 | * The invalid field. 21 | * 22 | * @var string 23 | */ 24 | private $field; 25 | 26 | /** 27 | * The invalid value. 28 | * 29 | * @var mixed 30 | */ 31 | private $value; 32 | 33 | /** 34 | * Constructor. 35 | * 36 | * @param string $field 37 | * @param mixed $value 38 | * @param int $code 39 | * @param \Exception|null $previous 40 | */ 41 | public function __construct($field, $value, $code = 0, Exception $previous = null) 42 | { 43 | $this->field = $field; 44 | $this->value = $value; 45 | parent::__construct($field.' : '.$value.' is not a valid value.', $code, $previous); 46 | } 47 | 48 | /** 49 | * Get the invalid field. 50 | * 51 | * @return string 52 | */ 53 | public function getField() 54 | { 55 | return $this->field; 56 | } 57 | 58 | /** 59 | * Get the invalid value. 60 | * 61 | * @return mixed 62 | */ 63 | public function getValue() 64 | { 65 | return $this->value; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/Carbon/Lang/sk.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => 'rok|:count roky|:count rokov', 14 | 'y' => 'rok|:count roky|:count rokov', 15 | 'month' => 'mesiac|:count mesiace|:count mesiacov', 16 | 'm' => 'mesiac|:count mesiace|:count mesiacov', 17 | 'week' => 'týždeň|:count týždne|:count týždňov', 18 | 'w' => 'týždeň|:count týždne|:count týždňov', 19 | 'day' => 'deň|:count dni|:count dní', 20 | 'd' => 'deň|:count dni|:count dní', 21 | 'hour' => 'hodinu|:count hodiny|:count hodín', 22 | 'h' => 'hodinu|:count hodiny|:count hodín', 23 | 'minute' => 'minútu|:count minúty|:count minút', 24 | 'min' => 'minútu|:count minúty|:count minút', 25 | 'second' => 'sekundu|:count sekundy|:count sekúnd', 26 | 's' => 'sekundu|:count sekundy|:count sekúnd', 27 | 'ago' => 'pred :time', 28 | 'from_now' => 'za :time', 29 | 'after' => 'o :time neskôr', 30 | 'before' => ':time predtým', 31 | 'year_ago' => 'rokom|:count rokmi|:count rokmi', 32 | 'month_ago' => 'mesiacom|:count mesiacmi|:count mesiacmi', 33 | 'week_ago' => 'týždňom|:count týždňami|:count týždňami', 34 | 'day_ago' => 'dňom|:count dňami|:count dňami', 35 | 'hour_ago' => 'hodinou|:count hodinami|:count hodinami', 36 | 'minute_ago' => 'minútou|:count minútami|:count minútami', 37 | 'second_ago' => 'sekundou|:count sekundami|:count sekundami', 38 | ); 39 | -------------------------------------------------------------------------------- /src/Carbon/Lang/ar_Shakl.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => '[0,1] سَنَة|{2} سَنَتَيْن|[3,10]:count سَنَوَات|[11,Inf]:count سَنَة', 14 | 'y' => '[0,1] سَنَة|{2} سَنَتَيْن|[3,10]:count سَنَوَات|[11,Inf]:count سَنَة', 15 | 'month' => '[0,1] شَهْرَ|{2} شَهْرَيْن|[3,10]:count أَشْهُر|[11,Inf]:count شَهْرَ', 16 | 'm' => '[0,1] شَهْرَ|{2} شَهْرَيْن|[3,10]:count أَشْهُر|[11,Inf]:count شَهْرَ', 17 | 'week' => '[0,1] أُسْبُوع|{2} أُسْبُوعَيْن|[3,10]:count أَسَابِيع|[11,Inf]:count أُسْبُوع', 18 | 'w' => '[0,1] أُسْبُوع|{2} أُسْبُوعَيْن|[3,10]:count أَسَابِيع|[11,Inf]:count أُسْبُوع', 19 | 'day' => '[0,1] يَوْم|{2} يَوْمَيْن|[3,10]:count أَيَّام|[11,Inf] يَوْم', 20 | 'd' => '[0,1] يَوْم|{2} يَوْمَيْن|[3,10]:count أَيَّام|[11,Inf] يَوْم', 21 | 'hour' => '[0,1] سَاعَة|{2} سَاعَتَيْن|[3,10]:count سَاعَات|[11,Inf]:count سَاعَة', 22 | 'h' => '[0,1] سَاعَة|{2} سَاعَتَيْن|[3,10]:count سَاعَات|[11,Inf]:count سَاعَة', 23 | 'minute' => '[0,1] دَقِيقَة|{2} دَقِيقَتَيْن|[3,10]:count دَقَائِق|[11,Inf]:count دَقِيقَة', 24 | 'min' => '[0,1] دَقِيقَة|{2} دَقِيقَتَيْن|[3,10]:count دَقَائِق|[11,Inf]:count دَقِيقَة', 25 | 'second' => '[0,1] ثَانِيَة|{2} ثَانِيَتَيْن|[3,10]:count ثَوَان|[11,Inf]:count ثَانِيَة', 26 | 's' => '[0,1] ثَانِيَة|{2} ثَانِيَتَيْن|[3,10]:count ثَوَان|[11,Inf]:count ثَانِيَة', 27 | 'ago' => 'مُنْذُ :time', 28 | 'from_now' => 'مِنَ الْآن :time', 29 | 'after' => 'بَعْدَ :time', 30 | 'before' => 'قَبْلَ :time', 31 | ); 32 | -------------------------------------------------------------------------------- /src/Carbon/Lang/sr.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count godina|:count godine|:count godina', 14 | 'y' => ':count godina|:count godine|:count godina', 15 | 'month' => ':count mesec|:count meseca|:count meseci', 16 | 'm' => ':count mesec|:count meseca|:count meseci', 17 | 'week' => ':count nedelja|:count nedelje|:count nedelja', 18 | 'w' => ':count nedelja|:count nedelje|:count nedelja', 19 | 'day' => ':count dan|:count dana|:count dana', 20 | 'd' => ':count dan|:count dana|:count dana', 21 | 'hour' => ':count sat|:count sata|:count sati', 22 | 'h' => ':count sat|:count sata|:count sati', 23 | 'minute' => ':count minut|:count minuta |:count minuta', 24 | 'min' => ':count minut|:count minuta |:count minuta', 25 | 'second' => ':count sekund|:count sekunde|:count sekunde', 26 | 's' => ':count sekund|:count sekunde|:count sekunde', 27 | 'ago' => 'pre :time', 28 | 'from_now' => ':time od sada', 29 | 'after' => 'nakon :time', 30 | 'before' => 'pre :time', 31 | 32 | 'year_from_now' => '{1,21,31,41,51} :count godinu|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54} :count godine|[5,Inf[ :count godina', 33 | 'year_ago' => '{1,21,31,41,51} :count godinu|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54} :count godine|[5,Inf[ :count godina', 34 | 35 | 'week_from_now' => '{1} :count nedelju|{2,3,4} :count nedelje|[5,Inf[ :count nedelja', 36 | 'week_ago' => '{1} :count nedelju|{2,3,4} :count nedelje|[5,Inf[ :count nedelja', 37 | ); 38 | -------------------------------------------------------------------------------- /src/Carbon/Lang/hu.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count év', 14 | 'y' => ':count év', 15 | 'month' => ':count hónap', 16 | 'm' => ':count hónap', 17 | 'week' => ':count hét', 18 | 'w' => ':count hét', 19 | 'day' => ':count nap', 20 | 'd' => ':count nap', 21 | 'hour' => ':count óra', 22 | 'h' => ':count óra', 23 | 'minute' => ':count perc', 24 | 'min' => ':count perc', 25 | 'second' => ':count másodperc', 26 | 's' => ':count másodperc', 27 | 'ago' => ':time', 28 | 'from_now' => ':time múlva', 29 | 'after' => ':time később', 30 | 'before' => ':time korábban', 31 | 'year_ago' => ':count éve', 32 | 'month_ago' => ':count hónapja', 33 | 'week_ago' => ':count hete', 34 | 'day_ago' => ':count napja', 35 | 'hour_ago' => ':count órája', 36 | 'minute_ago' => ':count perce', 37 | 'second_ago' => ':count másodperce', 38 | 'year_after' => ':count évvel', 39 | 'month_after' => ':count hónappal', 40 | 'week_after' => ':count héttel', 41 | 'day_after' => ':count nappal', 42 | 'hour_after' => ':count órával', 43 | 'minute_after' => ':count perccel', 44 | 'second_after' => ':count másodperccel', 45 | 'year_before' => ':count évvel', 46 | 'month_before' => ':count hónappal', 47 | 'week_before' => ':count héttel', 48 | 'day_before' => ':count nappal', 49 | 'hour_before' => ':count órával', 50 | 'minute_before' => ':count perccel', 51 | 'second_before' => ':count másodperccel', 52 | ); 53 | -------------------------------------------------------------------------------- /src/Carbon/Lang/lt.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count metus|:count metus|:count metų', 14 | 'y' => ':count metus|:count metus|:count metų', 15 | 'month' => ':count mėnesį|:count mėnesius|:count mėnesių', 16 | 'm' => ':count mėnesį|:count mėnesius|:count mėnesių', 17 | 'week' => ':count savaitę|:count savaites|:count savaičių', 18 | 'w' => ':count savaitę|:count savaites|:count savaičių', 19 | 'day' => ':count dieną|:count dienas|:count dienų', 20 | 'd' => ':count dieną|:count dienas|:count dienų', 21 | 'hour' => ':count valandą|:count valandas|:count valandų', 22 | 'h' => ':count valandą|:count valandas|:count valandų', 23 | 'minute' => ':count minutę|:count minutes|:count minučių', 24 | 'min' => ':count minutę|:count minutes|:count minučių', 25 | 'second' => ':count sekundę|:count sekundes|:count sekundžių', 26 | 's' => ':count sekundę|:count sekundes|:count sekundžių', 27 | 'second_from_now' => ':count sekundės|:count sekundžių|:count sekundžių', 28 | 'minute_from_now' => ':count minutės|:count minučių|:count minučių', 29 | 'hour_from_now' => ':count valandos|:count valandų|:count valandų', 30 | 'day_from_now' => ':count dienos|:count dienų|:count dienų', 31 | 'week_from_now' => ':count savaitės|:count savaičių|:count savaičių', 32 | 'month_from_now' => ':count mėnesio|:count mėnesių|:count mėnesių', 33 | 'year_from_now' => ':count metų', 34 | 'ago' => 'prieš :time', 35 | 'from_now' => 'už :time', 36 | 'after' => 'po :time', 37 | 'before' => ':time nuo dabar', 38 | ); 39 | -------------------------------------------------------------------------------- /src/Carbon/Lang/sr_Cyrl.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => '{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54}:count године|[0,Inf[ :count година', 14 | 'y' => ':count г.', 15 | 'month' => '{1} :count месец|{2,3,4}:count месеца|[5,Inf[ :count месеци', 16 | 'm' => ':count м.', 17 | 'week' => '{1} :count недеља|{2,3,4}:count недеље|[5,Inf[ :count недеља', 18 | 'w' => ':count нед.', 19 | 'day' => '{1,21,31} :count дан|[2,Inf[ :count дана', 20 | 'd' => ':count д.', 21 | 'hour' => '{1,21} :count сат|{2,3,4,22,23,24}:count сата|[5,Inf[ :count сати', 22 | 'h' => ':count ч.', 23 | 'minute' => '{1,21,31,41,51} :count минут|[2,Inf[ :count минута', 24 | 'min' => ':count мин.', 25 | 'second' => '{1,21,31,41,51} :count секунд|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54}:count секунде|[5,Inf[:count секунди', 26 | 's' => ':count сек.', 27 | 'ago' => 'пре :time', 28 | 'from_now' => 'за :time', 29 | 'after' => ':time након', 30 | 'before' => ':time пре', 31 | 32 | 'year_from_now' => '{1,21,31,41,51} :count годину|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54} :count године|[5,Inf[ :count година', 33 | 'year_ago' => '{1,21,31,41,51} :count годину|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54} :count године|[5,Inf[ :count година', 34 | 35 | 'week_from_now' => '{1} :count недељу|{2,3,4} :count недеље|[5,Inf[ :count недеља', 36 | 'week_ago' => '{1} :count недељу|{2,3,4} :count недеље|[5,Inf[ :count недеља', 37 | 38 | 'diff_now' => 'управо сада', 39 | 'diff_yesterday' => 'јуче', 40 | 'diff_tomorrow' => 'сутра', 41 | 'diff_before_yesterday' => 'прекјуче', 42 | 'diff_after_tomorrow' => 'прекосутра', 43 | ); 44 | -------------------------------------------------------------------------------- /src/Carbon/Lang/sr_Cyrl_ME.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => '{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54}:count године|[0,Inf[ :count година', 14 | 'y' => ':count г.', 15 | 'month' => '{1} :count мјесец|{2,3,4}:count мјесеца|[5,Inf[ :count мјесеци', 16 | 'm' => ':count мј.', 17 | 'week' => '{1} :count недјеља|{2,3,4}:count недјеље|[5,Inf[ :count недјеља', 18 | 'w' => ':count нед.', 19 | 'day' => '{1,21,31} :count дан|[2,Inf[ :count дана', 20 | 'd' => ':count д.', 21 | 'hour' => '{1,21} :count сат|{2,3,4,22,23,24}:count сата|[5,Inf[ :count сати', 22 | 'h' => ':count ч.', 23 | 'minute' => '{1,21,31,41,51} :count минут|[2,Inf[ :count минута', 24 | 'min' => ':count мин.', 25 | 'second' => '{1,21,31,41,51} :count секунд|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54}:count секунде|[5,Inf[:count секунди', 26 | 's' => ':count сек.', 27 | 'ago' => 'прије :time', 28 | 'from_now' => 'за :time', 29 | 'after' => ':time након', 30 | 'before' => ':time прије', 31 | 32 | 'year_from_now' => '{1,21,31,41,51} :count годину|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54} :count године|[5,Inf[ :count година', 33 | 'year_ago' => '{1,21,31,41,51} :count годину|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54} :count године|[5,Inf[ :count година', 34 | 35 | 'week_from_now' => '{1} :count недјељу|{2,3,4} :count недјеље|[5,Inf[ :count недјеља', 36 | 'week_ago' => '{1} :count недјељу|{2,3,4} :count недјеље|[5,Inf[ :count недјеља', 37 | 38 | 'diff_now' => 'управо сада', 39 | 'diff_yesterday' => 'јуче', 40 | 'diff_tomorrow' => 'сутра', 41 | 'diff_before_yesterday' => 'прекјуче', 42 | 'diff_after_tomorrow' => 'прекосјутра', 43 | ); 44 | -------------------------------------------------------------------------------- /src/Carbon/Lang/sr_Latn_ME.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => '{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54}:count godine|[0,Inf[ :count godina', 14 | 'y' => ':count g.', 15 | 'month' => '{1} :count mjesec|{2,3,4}:count mjeseca|[5,Inf[ :count mjeseci', 16 | 'm' => ':count mj.', 17 | 'week' => '{1} :count nedjelja|{2,3,4}:count nedjelje|[5,Inf[ :count nedjelja', 18 | 'w' => ':count ned.', 19 | 'day' => '{1,21,31} :count dan|[2,Inf[ :count dana', 20 | 'd' => ':count d.', 21 | 'hour' => '{1,21} :count sat|{2,3,4,22,23,24}:count sata|[5,Inf[ :count sati', 22 | 'h' => ':count č.', 23 | 'minute' => '{1,21,31,41,51} :count minut|[2,Inf[ :count minuta', 24 | 'min' => ':count min.', 25 | 'second' => '{1,21,31,41,51} :count sekund|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54}:count sekunde|[5,Inf[:count sekundi', 26 | 's' => ':count sek.', 27 | 'ago' => 'prije :time', 28 | 'from_now' => 'za :time', 29 | 'after' => ':time nakon', 30 | 'before' => ':time prije', 31 | 32 | 'year_from_now' => '{1,21,31,41,51} :count godinu|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54} :count godine|[5,Inf[ :count godina', 33 | 'year_ago' => '{1,21,31,41,51} :count godinu|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54} :count godine|[5,Inf[ :count godina', 34 | 35 | 'week_from_now' => '{1} :count nedjelju|{2,3,4} :count nedjelje|[5,Inf[ :count nedjelja', 36 | 'week_ago' => '{1} :count nedjelju|{2,3,4} :count nedjelje|[5,Inf[ :count nedjelja', 37 | 38 | 'diff_now' => 'upravo sada', 39 | 'diff_yesterday' => 'juče', 40 | 'diff_tomorrow' => 'sutra', 41 | 'diff_before_yesterday' => 'prekjuče', 42 | 'diff_after_tomorrow' => 'preksutra', 43 | ); 44 | -------------------------------------------------------------------------------- /.php_cs.dist: -------------------------------------------------------------------------------- 1 | true, 8 | 'array_syntax' => array( 9 | 'syntax' => 'long', 10 | ), 11 | 'binary_operator_spaces' => array( 12 | 'align_double_arrow' => false, 13 | 'align_equals' => false, 14 | ), 15 | 'blank_line_before_return' => true, 16 | 'cast_spaces' => true, 17 | 'concat_space' => array( 18 | 'spacing' => 'none', 19 | ), 20 | 'ereg_to_preg' => true, 21 | 'method_separation' => true, 22 | 'no_blank_lines_after_phpdoc' => true, 23 | 'no_extra_consecutive_blank_lines' => true, 24 | 'no_short_bool_cast' => true, 25 | 'no_unneeded_control_parentheses' => true, 26 | 'no_unused_imports' => true, 27 | 'no_whitespace_in_blank_line' => true, 28 | 'ordered_imports' => true, 29 | 'phpdoc_align' => true, 30 | 'phpdoc_indent' => true, 31 | 'phpdoc_inline_tag' => true, 32 | 'phpdoc_no_access' => true, 33 | 'phpdoc_no_alias_tag' => array( 34 | 'type' => 'var', 35 | ), 36 | 'phpdoc_no_package' => true, 37 | 'phpdoc_order' => true, 38 | 'phpdoc_scalar' => true, 39 | 'phpdoc_separation' => true, 40 | 'phpdoc_to_comment' => true, 41 | 'phpdoc_trim' => true, 42 | 'phpdoc_types' => true, 43 | 'phpdoc_var_without_name' => true, 44 | 'self_accessor' => true, 45 | 'single_quote' => true, 46 | 'space_after_semicolon' => true, 47 | 'standardize_not_equals' => true, 48 | 'ternary_operator_spaces' => true, 49 | 'trailing_comma_in_multiline_array' => true, 50 | 'trim_array_spaces' => true, 51 | 'unary_operator_spaces' => true, 52 | 'line_ending' => true, 53 | 'blank_line_after_namespace' => true, 54 | 'no_unused_imports' => true, 55 | ); 56 | 57 | return Config::create()->setRules($rules) 58 | ->setFinder(Finder::create()->in(__DIR__)) 59 | ->setUsingCache(true) 60 | ->setRiskyAllowed(true); 61 | -------------------------------------------------------------------------------- /src/Carbon/Lang/lv.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => '0 gadiem|:count gada|:count gadiem', 14 | 'y' => '0 gadiem|:count gada|:count gadiem', 15 | 'month' => '0 mēnešiem|:count mēneša|:count mēnešiem', 16 | 'm' => '0 mēnešiem|:count mēneša|:count mēnešiem', 17 | 'week' => '0 nedēļām|:count nedēļas|:count nedēļām', 18 | 'w' => '0 nedēļām|:count nedēļas|:count nedēļām', 19 | 'day' => '0 dienām|:count dienas|:count dienām', 20 | 'd' => '0 dienām|:count dienas|:count dienām', 21 | 'hour' => '0 stundām|:count stundas|:count stundām', 22 | 'h' => '0 stundām|:count stundas|:count stundām', 23 | 'minute' => '0 minūtēm|:count minūtes|:count minūtēm', 24 | 'min' => '0 minūtēm|:count minūtes|:count minūtēm', 25 | 'second' => '0 sekundēm|:count sekundes|:count sekundēm', 26 | 's' => '0 sekundēm|:count sekundes|:count sekundēm', 27 | 'ago' => 'pirms :time', 28 | 'from_now' => 'pēc :time', 29 | 'after' => ':time vēlāk', 30 | 'before' => ':time pirms', 31 | 32 | 'year_after' => '0 gadus|:count gadu|:count gadus', 33 | 'month_after' => '0 mēnešus|:count mēnesi|:count mēnešus', 34 | 'week_after' => '0 nedēļas|:count nedēļu|:count nedēļas', 35 | 'day_after' => '0 dienas|:count dienu|:count dienas', 36 | 'hour_after' => '0 stundas|:count stundu|:count stundas', 37 | 'minute_after' => '0 minūtes|:count minūti|:count minūtes', 38 | 'second_after' => '0 sekundes|:count sekundi|:count sekundes', 39 | 40 | 'year_before' => '0 gadus|:count gadu|:count gadus', 41 | 'month_before' => '0 mēnešus|:count mēnesi|:count mēnešus', 42 | 'week_before' => '0 nedēļas|:count nedēļu|:count nedēļas', 43 | 'day_before' => '0 dienas|:count dienu|:count dienas', 44 | 'hour_before' => '0 stundas|:count stundu|:count stundas', 45 | 'minute_before' => '0 minūtes|:count minūti|:count minūtes', 46 | 'second_before' => '0 sekundes|:count sekundi|:count sekundes', 47 | ); 48 | -------------------------------------------------------------------------------- /src/Carbon/Lang/sl.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return array( 13 | 'year' => ':count leto|:count leti|:count leta|:count let', 14 | 'y' => ':count leto|:count leti|:count leta|:count let', 15 | 'month' => ':count mesec|:count meseca|:count mesece|:count mesecev', 16 | 'm' => ':count mesec|:count meseca|:count mesece|:count mesecev', 17 | 'week' => ':count teden|:count tedna|:count tedne|:count tednov', 18 | 'w' => ':count teden|:count tedna|:count tedne|:count tednov', 19 | 'day' => ':count dan|:count dni|:count dni|:count dni', 20 | 'd' => ':count dan|:count dni|:count dni|:count dni', 21 | 'hour' => ':count uro|:count uri|:count ure|:count ur', 22 | 'h' => ':count uro|:count uri|:count ure|:count ur', 23 | 'minute' => ':count minuto|:count minuti|:count minute|:count minut', 24 | 'min' => ':count minuto|:count minuti|:count minute|:count minut', 25 | 'second' => ':count sekundo|:count sekundi|:count sekunde|:count sekund', 26 | 's' => ':count sekundo|:count sekundi|:count sekunde|:count sekund', 27 | 'year_ago' => ':count letom|:count leti|:count leti|:count leti', 28 | 'month_ago' => ':count mesecem|:count meseci|:count meseci|:count meseci', 29 | 'week_ago' => ':count tednom|:count tednoma|:count tedni|:count tedni', 30 | 'day_ago' => ':count dnem|:count dnevoma|:count dnevi|:count dnevi', 31 | 'hour_ago' => ':count uro|:count urama|:count urami|:count urami', 32 | 'minute_ago' => ':count minuto|:count minutama|:count minutami|:count minutami', 33 | 'second_ago' => ':count sekundo|:count sekundama|:count sekundami|:count sekundami', 34 | 'ago' => 'pred :time', 35 | 'from_now' => 'čez :time', 36 | 'after' => 'čez :time', 37 | 'before' => 'pred :time', 38 | 'diff_now' => 'ravnokar', 39 | 'diff_yesterday' => 'včeraj', 40 | 'diff_tomorrow' => 'jutri', 41 | 'diff_before_yesterday' => 'predvčerajšnjim', 42 | 'diff_after_tomorrow' => 'pojutrišnjem', 43 | ); 44 | -------------------------------------------------------------------------------- /src/Carbon/Lang/mn.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * 9 | * For the full copyright and license information, please view the LICENSE 10 | * file that was distributed with this source code. 11 | * 12 | * @translator Batmandakh Erdenebileg 13 | */ 14 | 15 | return array( 16 | 'year' => ':count жил', 17 | 'y' => ':count жил', 18 | 'month' => ':count сар', 19 | 'm' => ':count сар', 20 | 'week' => ':count долоо хоног', 21 | 'w' => ':count долоо хоног', 22 | 'day' => ':count өдөр', 23 | 'd' => ':count өдөр', 24 | 'hour' => ':count цаг', 25 | 'h' => ':countц', 26 | 'minute' => ':count минут', 27 | 'min' => ':countм', 28 | 'second' => ':count секунд', 29 | 's' => ':countс', 30 | 31 | 'ago' => ':timeн өмнө', 32 | 'year_ago' => ':count жилий', 33 | 'month_ago' => ':count сары', 34 | 'day_ago' => ':count хоногий', 35 | 'hour_ago' => ':count цагий', 36 | 'minute_ago' => ':count минуты', 37 | 'second_ago' => ':count секунды', 38 | 39 | 'from_now' => 'одоогоос :time', 40 | 'year_from_now' => ':count жилийн дараа', 41 | 'month_from_now' => ':count сарын дараа', 42 | 'day_from_now' => ':count хоногийн дараа', 43 | 'hour_from_now' => ':count цагийн дараа', 44 | 'minute_from_now' => ':count минутын дараа', 45 | 'second_from_now' => ':count секундын дараа', 46 | 47 | // Does it required to make translation for before, after as follows? hmm, I think we've made it with ago and from now keywords already. Anyway, I've included it just in case of undesired action... 48 | 'after' => ':timeн дараа', 49 | 'year_after' => ':count жилий', 50 | 'month_after' => ':count сары', 51 | 'day_after' => ':count хоногий', 52 | 'hour_after' => ':count цагий', 53 | 'minute_after' => ':count минуты', 54 | 'second_after' => ':count секунды', 55 | 'before' => ':timeн өмнө', 56 | 'year_before' => ':count жилий', 57 | 'month_before' => ':count сары', 58 | 'day_before' => ':count хоногий', 59 | 'hour_before' => ':count цагий', 60 | 'minute_before' => ':count минуты', 61 | 'second_before' => ':count секунды', 62 | ); 63 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # Carbon 2 | 3 | [![Latest Stable Version](https://poser.pugx.org/nesbot/carbon/v/stable.png)](https://packagist.org/packages/nesbot/carbon) 4 | [![Total Downloads](https://poser.pugx.org/nesbot/carbon/downloads.png)](https://packagist.org/packages/nesbot/carbon) 5 | [![Build Status](https://travis-ci.org/briannesbitt/Carbon.svg?branch=master)](https://travis-ci.org/briannesbitt/Carbon) 6 | [![StyleCI](https://styleci.io/repos/5724990/shield?style=flat)](https://styleci.io/repos/5724990) 7 | [![codecov.io](https://codecov.io/github/briannesbitt/Carbon/coverage.svg?branch=master)](https://codecov.io/github/briannesbitt/Carbon?branch=master) 8 | [![PHP-Eye](https://php-eye.com/badge/nesbot/carbon/tested.svg?style=flat)](https://php-eye.com/package/nesbot/carbon) 9 | [![PHPStan](https://img.shields.io/badge/PHPStan-enabled-brightgreen.svg?style=flat)](https://github.com/phpstan/phpstan) 10 | 11 | A simple PHP API extension for DateTime. [http://carbon.nesbot.com](http://carbon.nesbot.com) 12 | 13 | ```php 14 | use Carbon\Carbon; 15 | 16 | printf("Right now is %s", Carbon::now()->toDateTimeString()); 17 | printf("Right now in Vancouver is %s", Carbon::now('America/Vancouver')); //implicit __toString() 18 | $tomorrow = Carbon::now()->addDay(); 19 | $lastWeek = Carbon::now()->subWeek(); 20 | $nextSummerOlympics = Carbon::createFromDate(2016)->addYears(4); 21 | 22 | $officialDate = Carbon::now()->toRfc2822String(); 23 | 24 | $howOldAmI = Carbon::createFromDate(1975, 5, 21)->age; 25 | 26 | $noonTodayLondonTime = Carbon::createFromTime(12, 0, 0, 'Europe/London'); 27 | 28 | $internetWillBlowUpOn = Carbon::create(2038, 01, 19, 3, 14, 7, 'GMT'); 29 | 30 | // Don't really want this to happen so mock now 31 | Carbon::setTestNow(Carbon::createFromDate(2000, 1, 1)); 32 | 33 | // comparisons are always done in UTC 34 | if (Carbon::now()->gte($internetWillBlowUpOn)) { 35 | die(); 36 | } 37 | 38 | // Phew! Return to normal behaviour 39 | Carbon::setTestNow(); 40 | 41 | if (Carbon::now()->isWeekend()) { 42 | echo 'Party!'; 43 | } 44 | echo Carbon::now()->subMinutes(2)->diffForHumans(); // '2 minutes ago' 45 | 46 | // ... but also does 'from now', 'after' and 'before' 47 | // rolling up to seconds, minutes, hours, days, months, years 48 | 49 | $daysSinceEpoch = Carbon::createFromTimestamp(0)->diffInDays(); 50 | ``` 51 | 52 | ## Installation 53 | 54 | ### With Composer 55 | 56 | ``` 57 | $ composer require nesbot/carbon 58 | ``` 59 | 60 | ```json 61 | { 62 | "require": { 63 | "nesbot/carbon": "~1.21" 64 | } 65 | } 66 | ``` 67 | 68 | ```php 69 | 78 | 79 | ### Without Composer 80 | 81 | Why are you not using [composer](http://getcomposer.org/)? Download [Carbon.php](https://github.com/briannesbitt/Carbon/blob/master/src/Carbon/Carbon.php) from the repo and save the file into your project path somewhere. 82 | 83 | ```php 84 | addLoader('array', new Translation\Loader\ArrayLoader()); 42 | parent::__construct($locale, $formatter, $cacheDir, $debug); 43 | } 44 | 45 | /** 46 | * Reset messages of a locale (all locale if no locale passed). 47 | * Remove custom messages and reload initial messages from matching 48 | * file in Lang directory. 49 | * 50 | * @param string|null $locale 51 | * 52 | * @return bool 53 | */ 54 | public function resetMessages($locale = null) 55 | { 56 | if ($locale === null) { 57 | static::$messages = array(); 58 | 59 | return true; 60 | } 61 | 62 | if (file_exists($filename = __DIR__.'/Lang/'.$locale.'.php')) { 63 | static::$messages[$locale] = require $filename; 64 | $this->addResource('array', static::$messages[$locale], $locale); 65 | 66 | return true; 67 | } 68 | 69 | return false; 70 | } 71 | 72 | /** 73 | * Init messages language from matching file in Lang directory. 74 | * 75 | * @param string $locale 76 | * 77 | * @return bool 78 | */ 79 | protected function loadMessagesFromFile($locale) 80 | { 81 | if (isset(static::$messages[$locale])) { 82 | return true; 83 | } 84 | 85 | return $this->resetMessages($locale); 86 | } 87 | 88 | /** 89 | * Set messages of a locale and take file first if present. 90 | * 91 | * @param string $locale 92 | * @param array $messages 93 | * 94 | * @return $this 95 | */ 96 | public function setMessages($locale, $messages) 97 | { 98 | $this->loadMessagesFromFile($locale); 99 | $this->addResource('array', $messages, $locale); 100 | static::$messages[$locale] = array_merge( 101 | isset(static::$messages[$locale]) ? static::$messages[$locale] : array(), 102 | $messages 103 | ); 104 | 105 | return $this; 106 | } 107 | 108 | /** 109 | * Get messages of a locale, if none given, return all the 110 | * languages. 111 | * 112 | * @param string|null $locale 113 | * 114 | * @return array 115 | */ 116 | public function getMessages($locale = null) 117 | { 118 | return $locale === null ? static::$messages : static::$messages[$locale]; 119 | } 120 | 121 | /** 122 | * Set the current translator locale and indicate if the source locale file exists 123 | * 124 | * @param string $locale locale ex. en 125 | * 126 | * @return bool 127 | */ 128 | public function setLocale($locale) 129 | { 130 | $locale = preg_replace_callback('/[-_]([a-z]{2,})/', function ($matches) { 131 | // _2-letters is a region, _3+-letters is a variant 132 | return '_'.call_user_func(strlen($matches[1]) > 2 ? 'ucfirst' : 'strtoupper', $matches[1]); 133 | }, strtolower($locale)); 134 | 135 | if ($this->loadMessagesFromFile($locale)) { 136 | parent::setLocale($locale); 137 | 138 | return true; 139 | } 140 | 141 | return false; 142 | } 143 | } 144 | -------------------------------------------------------------------------------- /src/Carbon/CarbonInterval.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Carbon; 13 | 14 | use DateInterval; 15 | use InvalidArgumentException; 16 | use Symfony\Component\Translation\TranslatorInterface; 17 | 18 | /** 19 | * A simple API extension for DateInterval. 20 | * The implementation provides helpers to handle weeks but only days are saved. 21 | * Weeks are calculated based on the total days of the current instance. 22 | * 23 | * @property int $years Total years of the current interval. 24 | * @property int $months Total months of the current interval. 25 | * @property int $weeks Total weeks of the current interval calculated from the days. 26 | * @property int $dayz Total days of the current interval (weeks * 7 + days). 27 | * @property int $hours Total hours of the current interval. 28 | * @property int $minutes Total minutes of the current interval. 29 | * @property int $seconds Total seconds of the current interval. 30 | * @property-read int $dayzExcludeWeeks Total days remaining in the final week of the current instance (days % 7). 31 | * @property-read int $daysExcludeWeeks alias of dayzExcludeWeeks 32 | * 33 | * @method static CarbonInterval years($years = 1) Create instance specifying a number of years. 34 | * @method static CarbonInterval year($years = 1) Alias for years() 35 | * @method static CarbonInterval months($months = 1) Create instance specifying a number of months. 36 | * @method static CarbonInterval month($months = 1) Alias for months() 37 | * @method static CarbonInterval weeks($weeks = 1) Create instance specifying a number of weeks. 38 | * @method static CarbonInterval week($weeks = 1) Alias for weeks() 39 | * @method static CarbonInterval days($days = 1) Create instance specifying a number of days. 40 | * @method static CarbonInterval dayz($days = 1) Alias for days() 41 | * @method static CarbonInterval day($days = 1) Alias for days() 42 | * @method static CarbonInterval hours($hours = 1) Create instance specifying a number of hours. 43 | * @method static CarbonInterval hour($hours = 1) Alias for hours() 44 | * @method static CarbonInterval minutes($minutes = 1) Create instance specifying a number of minutes. 45 | * @method static CarbonInterval minute($minutes = 1) Alias for minutes() 46 | * @method static CarbonInterval seconds($seconds = 1) Create instance specifying a number of seconds. 47 | * @method static CarbonInterval second($seconds = 1) Alias for seconds() 48 | * @method CarbonInterval years($years = 1) Set the years portion of the current interval. 49 | * @method CarbonInterval year($years = 1) Alias for years(). 50 | * @method CarbonInterval months($months = 1) Set the months portion of the current interval. 51 | * @method CarbonInterval month($months = 1) Alias for months(). 52 | * @method CarbonInterval weeks($weeks = 1) Set the weeks portion of the current interval. Will overwrite dayz value. 53 | * @method CarbonInterval week($weeks = 1) Alias for weeks(). 54 | * @method CarbonInterval days($days = 1) Set the days portion of the current interval. 55 | * @method CarbonInterval dayz($days = 1) Alias for days(). 56 | * @method CarbonInterval day($days = 1) Alias for days(). 57 | * @method CarbonInterval hours($hours = 1) Set the hours portion of the current interval. 58 | * @method CarbonInterval hour($hours = 1) Alias for hours(). 59 | * @method CarbonInterval minutes($minutes = 1) Set the minutes portion of the current interval. 60 | * @method CarbonInterval minute($minutes = 1) Alias for minutes(). 61 | * @method CarbonInterval seconds($seconds = 1) Set the seconds portion of the current interval. 62 | * @method CarbonInterval second($seconds = 1) Alias for seconds(). 63 | */ 64 | class CarbonInterval extends DateInterval 65 | { 66 | /** 67 | * Interval spec period designators 68 | */ 69 | const PERIOD_PREFIX = 'P'; 70 | const PERIOD_YEARS = 'Y'; 71 | const PERIOD_MONTHS = 'M'; 72 | const PERIOD_DAYS = 'D'; 73 | const PERIOD_TIME_PREFIX = 'T'; 74 | const PERIOD_HOURS = 'H'; 75 | const PERIOD_MINUTES = 'M'; 76 | const PERIOD_SECONDS = 'S'; 77 | 78 | /** 79 | * A translator to ... er ... translate stuff 80 | * 81 | * @var \Symfony\Component\Translation\TranslatorInterface 82 | */ 83 | protected static $translator; 84 | 85 | /** 86 | * Before PHP 5.4.20/5.5.4 instead of FALSE days will be set to -99999 when the interval instance 87 | * was created by DateTime::diff(). 88 | */ 89 | const PHP_DAYS_FALSE = -99999; 90 | 91 | /** 92 | * Determine if the interval was created via DateTime:diff() or not. 93 | * 94 | * @param DateInterval $interval 95 | * 96 | * @return bool 97 | */ 98 | private static function wasCreatedFromDiff(DateInterval $interval) 99 | { 100 | return $interval->days !== false && $interval->days !== static::PHP_DAYS_FALSE; 101 | } 102 | 103 | /////////////////////////////////////////////////////////////////// 104 | //////////////////////////// CONSTRUCTORS ///////////////////////// 105 | /////////////////////////////////////////////////////////////////// 106 | 107 | /** 108 | * Create a new CarbonInterval instance. 109 | * 110 | * @param int $years 111 | * @param int $months 112 | * @param int $weeks 113 | * @param int $days 114 | * @param int $hours 115 | * @param int $minutes 116 | * @param int $seconds 117 | */ 118 | public function __construct($years = 1, $months = null, $weeks = null, $days = null, $hours = null, $minutes = null, $seconds = null) 119 | { 120 | $spec = $years; 121 | 122 | if (!is_string($spec) || floatval($years) || preg_match('/^[0-9.]/', $years)) { 123 | $spec = static::PERIOD_PREFIX; 124 | 125 | $spec .= $years > 0 ? $years.static::PERIOD_YEARS : ''; 126 | $spec .= $months > 0 ? $months.static::PERIOD_MONTHS : ''; 127 | 128 | $specDays = 0; 129 | $specDays += $weeks > 0 ? $weeks * Carbon::DAYS_PER_WEEK : 0; 130 | $specDays += $days > 0 ? $days : 0; 131 | 132 | $spec .= $specDays > 0 ? $specDays.static::PERIOD_DAYS : ''; 133 | 134 | if ($hours > 0 || $minutes > 0 || $seconds > 0) { 135 | $spec .= static::PERIOD_TIME_PREFIX; 136 | $spec .= $hours > 0 ? $hours.static::PERIOD_HOURS : ''; 137 | $spec .= $minutes > 0 ? $minutes.static::PERIOD_MINUTES : ''; 138 | $spec .= $seconds > 0 ? $seconds.static::PERIOD_SECONDS : ''; 139 | } 140 | 141 | if ($spec === static::PERIOD_PREFIX) { 142 | // Allow the zero interval. 143 | $spec .= '0'.static::PERIOD_YEARS; 144 | } 145 | } 146 | 147 | parent::__construct($spec); 148 | } 149 | 150 | /** 151 | * Create a new CarbonInterval instance from specific values. 152 | * This is an alias for the constructor that allows better fluent 153 | * syntax as it allows you to do CarbonInterval::create(1)->fn() rather than 154 | * (new CarbonInterval(1))->fn(). 155 | * 156 | * @param int $years 157 | * @param int $months 158 | * @param int $weeks 159 | * @param int $days 160 | * @param int $hours 161 | * @param int $minutes 162 | * @param int $seconds 163 | * 164 | * @return static 165 | */ 166 | public static function create($years = 1, $months = null, $weeks = null, $days = null, $hours = null, $minutes = null, $seconds = null) 167 | { 168 | return new static($years, $months, $weeks, $days, $hours, $minutes, $seconds); 169 | } 170 | 171 | /** 172 | * Provide static helpers to create instances. Allows CarbonInterval::years(3). 173 | * 174 | * Note: This is done using the magic method to allow static and instance methods to 175 | * have the same names. 176 | * 177 | * @param string $name 178 | * @param array $args 179 | * 180 | * @return static 181 | */ 182 | public static function __callStatic($name, $args) 183 | { 184 | $arg = count($args) === 0 ? 1 : $args[0]; 185 | 186 | switch ($name) { 187 | case 'years': 188 | case 'year': 189 | return new static($arg); 190 | 191 | case 'months': 192 | case 'month': 193 | return new static(null, $arg); 194 | 195 | case 'weeks': 196 | case 'week': 197 | return new static(null, null, $arg); 198 | 199 | case 'days': 200 | case 'dayz': 201 | case 'day': 202 | return new static(null, null, null, $arg); 203 | 204 | case 'hours': 205 | case 'hour': 206 | return new static(null, null, null, null, $arg); 207 | 208 | case 'minutes': 209 | case 'minute': 210 | return new static(null, null, null, null, null, $arg); 211 | 212 | case 'seconds': 213 | case 'second': 214 | return new static(null, null, null, null, null, null, $arg); 215 | } 216 | } 217 | 218 | /** 219 | * Creates a CarbonInterval from string 220 | * 221 | * Format: 222 | * 223 | * Suffix | Unit | Example | DateInterval expression 224 | * -------|---------|---------|------------------------ 225 | * y | years | 1y | P1Y 226 | * mo | months | 3mo | P3M 227 | * w | weeks | 2w | P2W 228 | * d | days | 28d | P28D 229 | * h | hours | 4h | PT4H 230 | * m | minutes | 12m | PT12M 231 | * s | seconds | 59s | PT59S 232 | * 233 | * e. g. `1w 3d 4h 32m 23s` is converted to 10 days 4 hours 32 minutes and 23 seconds. 234 | * 235 | * Special cases: 236 | * - An empty string will return a zero interval 237 | * - Fractions are allowed for weeks, days, hours and minutes and will be converted 238 | * and rounded to the next smaller value (caution: 0.5w = 4d) 239 | * 240 | * @param string $intervalDefinition 241 | * 242 | * @return static 243 | */ 244 | public static function fromString($intervalDefinition) 245 | { 246 | if (empty($intervalDefinition)) { 247 | return new static(0); 248 | } 249 | 250 | $years = 0; 251 | $months = 0; 252 | $weeks = 0; 253 | $days = 0; 254 | $hours = 0; 255 | $minutes = 0; 256 | $seconds = 0; 257 | 258 | $pattern = '/(\d+(?:\.\d+)?)\h*([^\d\h]*)/i'; 259 | preg_match_all($pattern, $intervalDefinition, $parts, PREG_SET_ORDER); 260 | while ($match = array_shift($parts)) { 261 | list($part, $value, $unit) = $match; 262 | $intValue = intval($value); 263 | $fraction = floatval($value) - $intValue; 264 | switch (strtolower($unit)) { 265 | case 'year': 266 | case 'years': 267 | case 'y': 268 | $years += $intValue; 269 | break; 270 | 271 | case 'month': 272 | case 'months': 273 | case 'mo': 274 | $months += $intValue; 275 | break; 276 | 277 | case 'week': 278 | case 'weeks': 279 | case 'w': 280 | $weeks += $intValue; 281 | if ($fraction != 0) { 282 | $parts[] = array(null, $fraction * Carbon::DAYS_PER_WEEK, 'd'); 283 | } 284 | break; 285 | 286 | case 'day': 287 | case 'days': 288 | case 'd': 289 | $days += $intValue; 290 | if ($fraction != 0) { 291 | $parts[] = array(null, $fraction * Carbon::HOURS_PER_DAY, 'h'); 292 | } 293 | break; 294 | 295 | case 'hour': 296 | case 'hours': 297 | case 'h': 298 | $hours += $intValue; 299 | if ($fraction != 0) { 300 | $parts[] = array(null, $fraction * Carbon::MINUTES_PER_HOUR, 'm'); 301 | } 302 | break; 303 | 304 | case 'minute': 305 | case 'minutes': 306 | case 'm': 307 | $minutes += $intValue; 308 | if ($fraction != 0) { 309 | $seconds += round($fraction * Carbon::SECONDS_PER_MINUTE); 310 | } 311 | break; 312 | 313 | case 'second': 314 | case 'seconds': 315 | case 's': 316 | $seconds += $intValue; 317 | break; 318 | 319 | default: 320 | throw new InvalidArgumentException( 321 | sprintf('Invalid part %s in definition %s', $part, $intervalDefinition) 322 | ); 323 | } 324 | } 325 | 326 | return new static($years, $months, $weeks, $days, $hours, $minutes, $seconds); 327 | } 328 | 329 | /** 330 | * Create a CarbonInterval instance from a DateInterval one. Can not instance 331 | * DateInterval objects created from DateTime::diff() as you can't externally 332 | * set the $days field. 333 | * 334 | * @param DateInterval $di 335 | * 336 | * @return static 337 | */ 338 | public static function instance(DateInterval $di) 339 | { 340 | $instance = new static(static::getDateIntervalSpec($di)); 341 | $instance->invert = $di->invert; 342 | 343 | return $instance; 344 | } 345 | 346 | /////////////////////////////////////////////////////////////////// 347 | /////////////////////// LOCALIZATION ////////////////////////////// 348 | /////////////////////////////////////////////////////////////////// 349 | 350 | /** 351 | * Initialize the translator instance if necessary. 352 | * 353 | * @return \Symfony\Component\Translation\TranslatorInterface 354 | */ 355 | protected static function translator() 356 | { 357 | if (static::$translator === null) { 358 | static::$translator = Translator::get(); 359 | } 360 | 361 | return static::$translator; 362 | } 363 | 364 | /** 365 | * Get the translator instance in use 366 | * 367 | * @return \Symfony\Component\Translation\TranslatorInterface 368 | */ 369 | public static function getTranslator() 370 | { 371 | return static::translator(); 372 | } 373 | 374 | /** 375 | * Set the translator instance to use 376 | * 377 | * @param TranslatorInterface $translator 378 | */ 379 | public static function setTranslator(TranslatorInterface $translator) 380 | { 381 | static::$translator = $translator; 382 | } 383 | 384 | /** 385 | * Get the current translator locale 386 | * 387 | * @return string 388 | */ 389 | public static function getLocale() 390 | { 391 | return static::translator()->getLocale(); 392 | } 393 | 394 | /** 395 | * Set the current translator locale 396 | * 397 | * @param string $locale 398 | */ 399 | public static function setLocale($locale) 400 | { 401 | return static::translator()->setLocale($locale) !== false; 402 | } 403 | 404 | /////////////////////////////////////////////////////////////////// 405 | ///////////////////////// GETTERS AND SETTERS ///////////////////// 406 | /////////////////////////////////////////////////////////////////// 407 | 408 | /** 409 | * Get a part of the CarbonInterval object 410 | * 411 | * @param string $name 412 | * 413 | * @throws \InvalidArgumentException 414 | * 415 | * @return int 416 | */ 417 | public function __get($name) 418 | { 419 | switch ($name) { 420 | case 'years': 421 | return $this->y; 422 | 423 | case 'months': 424 | return $this->m; 425 | 426 | case 'dayz': 427 | return $this->d; 428 | 429 | case 'hours': 430 | return $this->h; 431 | 432 | case 'minutes': 433 | return $this->i; 434 | 435 | case 'seconds': 436 | return $this->s; 437 | 438 | case 'weeks': 439 | return (int) floor($this->d / Carbon::DAYS_PER_WEEK); 440 | 441 | case 'daysExcludeWeeks': 442 | case 'dayzExcludeWeeks': 443 | return $this->d % Carbon::DAYS_PER_WEEK; 444 | 445 | default: 446 | throw new InvalidArgumentException(sprintf("Unknown getter '%s'", $name)); 447 | } 448 | } 449 | 450 | /** 451 | * Set a part of the CarbonInterval object 452 | * 453 | * @param string $name 454 | * @param int $val 455 | * 456 | * @throws \InvalidArgumentException 457 | */ 458 | public function __set($name, $val) 459 | { 460 | switch ($name) { 461 | case 'years': 462 | $this->y = $val; 463 | break; 464 | 465 | case 'months': 466 | $this->m = $val; 467 | break; 468 | 469 | case 'weeks': 470 | $this->d = $val * Carbon::DAYS_PER_WEEK; 471 | break; 472 | 473 | case 'dayz': 474 | $this->d = $val; 475 | break; 476 | 477 | case 'hours': 478 | $this->h = $val; 479 | break; 480 | 481 | case 'minutes': 482 | $this->i = $val; 483 | break; 484 | 485 | case 'seconds': 486 | $this->s = $val; 487 | break; 488 | } 489 | } 490 | 491 | /** 492 | * Allow setting of weeks and days to be cumulative. 493 | * 494 | * @param int $weeks Number of weeks to set 495 | * @param int $days Number of days to set 496 | * 497 | * @return static 498 | */ 499 | public function weeksAndDays($weeks, $days) 500 | { 501 | $this->dayz = ($weeks * Carbon::DAYS_PER_WEEK) + $days; 502 | 503 | return $this; 504 | } 505 | 506 | /** 507 | * Allow fluent calls on the setters... CarbonInterval::years(3)->months(5)->day(). 508 | * 509 | * Note: This is done using the magic method to allow static and instance methods to 510 | * have the same names. 511 | * 512 | * @param string $name 513 | * @param array $args 514 | * 515 | * @return static 516 | */ 517 | public function __call($name, $args) 518 | { 519 | $arg = count($args) === 0 ? 1 : $args[0]; 520 | 521 | switch ($name) { 522 | case 'years': 523 | case 'year': 524 | $this->years = $arg; 525 | break; 526 | 527 | case 'months': 528 | case 'month': 529 | $this->months = $arg; 530 | break; 531 | 532 | case 'weeks': 533 | case 'week': 534 | $this->dayz = $arg * Carbon::DAYS_PER_WEEK; 535 | break; 536 | 537 | case 'days': 538 | case 'dayz': 539 | case 'day': 540 | $this->dayz = $arg; 541 | break; 542 | 543 | case 'hours': 544 | case 'hour': 545 | $this->hours = $arg; 546 | break; 547 | 548 | case 'minutes': 549 | case 'minute': 550 | $this->minutes = $arg; 551 | break; 552 | 553 | case 'seconds': 554 | case 'second': 555 | $this->seconds = $arg; 556 | break; 557 | } 558 | 559 | return $this; 560 | } 561 | 562 | /** 563 | * Get the current interval in a human readable format in the current locale. 564 | * 565 | * @return string 566 | */ 567 | public function forHumans() 568 | { 569 | $periods = array( 570 | 'year' => $this->years, 571 | 'month' => $this->months, 572 | 'week' => $this->weeks, 573 | 'day' => $this->daysExcludeWeeks, 574 | 'hour' => $this->hours, 575 | 'minute' => $this->minutes, 576 | 'second' => $this->seconds, 577 | ); 578 | 579 | $parts = array(); 580 | foreach ($periods as $unit => $count) { 581 | if ($count > 0) { 582 | $parts[] = static::translator()->transChoice($unit, $count, array(':count' => $count)); 583 | } 584 | } 585 | 586 | return implode(' ', $parts); 587 | } 588 | 589 | /** 590 | * Format the instance as a string using the forHumans() function. 591 | * 592 | * @return string 593 | */ 594 | public function __toString() 595 | { 596 | return $this->forHumans(); 597 | } 598 | 599 | /** 600 | * Add the passed interval to the current instance 601 | * 602 | * @param DateInterval $interval 603 | * 604 | * @return static 605 | */ 606 | public function add(DateInterval $interval) 607 | { 608 | $sign = $interval->invert === 1 ? -1 : 1; 609 | 610 | if (static::wasCreatedFromDiff($interval)) { 611 | $this->dayz += $interval->days * $sign; 612 | } else { 613 | $this->years += $interval->y * $sign; 614 | $this->months += $interval->m * $sign; 615 | $this->dayz += $interval->d * $sign; 616 | $this->hours += $interval->h * $sign; 617 | $this->minutes += $interval->i * $sign; 618 | $this->seconds += $interval->s * $sign; 619 | } 620 | 621 | return $this; 622 | } 623 | 624 | /** 625 | * Multiply current instance given number of times 626 | * 627 | * @param float $factor 628 | * 629 | * @return $this 630 | */ 631 | public function times($factor) 632 | { 633 | if ($factor < 0) { 634 | $this->invert = $this->invert ? 0 : 1; 635 | $factor = -$factor; 636 | } 637 | 638 | $this->years = round($this->years * $factor); 639 | $this->months = round($this->months * $factor); 640 | $this->dayz = round($this->dayz * $factor); 641 | $this->hours = round($this->hours * $factor); 642 | $this->minutes = round($this->minutes * $factor); 643 | $this->seconds = round($this->seconds * $factor); 644 | 645 | return $this; 646 | } 647 | 648 | /** 649 | * Get the interval_spec string of a date interval 650 | * 651 | * @param DateInterval $interval 652 | * 653 | * @return string 654 | */ 655 | public static function getDateIntervalSpec(DateInterval $interval) 656 | { 657 | $date = array_filter(array( 658 | static::PERIOD_YEARS => $interval->y, 659 | static::PERIOD_MONTHS => $interval->m, 660 | static::PERIOD_DAYS => $interval->d, 661 | )); 662 | 663 | $time = array_filter(array( 664 | static::PERIOD_HOURS => $interval->h, 665 | static::PERIOD_MINUTES => $interval->i, 666 | static::PERIOD_SECONDS => $interval->s, 667 | )); 668 | 669 | $specString = static::PERIOD_PREFIX; 670 | 671 | foreach ($date as $key => $value) { 672 | $specString .= $value.$key; 673 | } 674 | 675 | if (count($time) > 0) { 676 | $specString .= static::PERIOD_TIME_PREFIX; 677 | foreach ($time as $key => $value) { 678 | $specString .= $value.$key; 679 | } 680 | } 681 | 682 | return $specString === static::PERIOD_PREFIX ? 'PT0S' : $specString; 683 | } 684 | 685 | /** 686 | * Get the interval_spec string 687 | * 688 | * @return string 689 | */ 690 | public function spec() 691 | { 692 | return static::getDateIntervalSpec($this); 693 | } 694 | 695 | /** 696 | * Comparing 2 date intervals 697 | * 698 | * @param DateInterval $a 699 | * @param DateInterval $b 700 | * 701 | * @return int 702 | */ 703 | public static function compareDateIntervals(DateInterval $a, DateInterval $b) 704 | { 705 | $current = Carbon::now(); 706 | $passed = $current->copy()->add($b); 707 | $current->add($a); 708 | 709 | if ($current < $passed) { 710 | return -1; 711 | } elseif ($current > $passed) { 712 | return 1; 713 | } 714 | 715 | return 0; 716 | } 717 | 718 | /** 719 | * Comparing with passed interval 720 | * 721 | * @param DateInterval $interval 722 | * 723 | * @return int 724 | */ 725 | public function compare(DateInterval $interval) 726 | { 727 | return static::compareDateIntervals($this, $interval); 728 | } 729 | } 730 | --------------------------------------------------------------------------------