Git Product home page Git Product logo

date's Introduction

Date

Latest Stable Version Total Downloads Build Status Coverage Status Donate

This date library extends Carbon with multi-language support. Methods such as format, diffForHumans, parse, createFromFormat and the new timespan, will now be translated based on your locale.

All translations made by contributors have been moved to the Carbon 2 package. This package now uses the Carbon translations to provide you with better multi-language support. Translation issues should be reported on the Carbon repository. Please also check out the original documentation here.

Installation

Install using composer:

composer require jenssegers/date

Laravel

There is a service provider included for integration with the Laravel framework. This provider will get the application locale setting and use this for translations. This service will be automatically registered if you use Laravel 5.5+ using the auto-discovery. Else to register the service provider, add the following to the providers array in config/app.php:

Jenssegers\Date\DateServiceProvider::class,

You can also add it as a Facade in config/app.php:

'Date' => Jenssegers\Date\Date::class,

Languages

This package contains language files for the following languages (https://carbon.nesbot.com/docs/#supported-locales):

  • Afar (aa)
  • Afrikaans (af)
  • Aghem (agq)
  • Aguaruna (agr)
  • Akan (ak)
  • Amharic (am)
  • Aragonese (an)
  • Angika (anp)
  • Arabic (ar)
  • Assamese (as)
  • Asu (asa)
  • Asturian (ast)
  • Southern Aymara (ayc)
  • Azerbaijani (az)
  • Basaa (bas)
  • Belarusian (be)
  • Bemba (bem)
  • ber (ber)
  • Bena (bez)
  • Bulgarian (bg)
  • Bhili (bhb)
  • Bhojpuri (bho)
  • Bislama (bi)
  • Bambara (bm)
  • Bengali (bn)
  • Tibetan (bo)
  • Breton (br)
  • Bodo (brx)
  • Bosnian (bs)
  • Bilin (byn)
  • Catalan (ca)
  • Chakma (ccp)
  • Chechen (ce)
  • Chiga (cgg)
  • Cherokee (chr)
  • Chinese (cmn)
  • Crimean Turkish (crh)
  • Czech (cs)
  • Kashubian (csb)
  • Church Slavic (cu)
  • Chuvash (cv)
  • Welsh (cy)
  • Danish (da)
  • Taita (dav)
  • German (de)
  • Zarma (dje)
  • Dogri (macrolanguage) (doi)
  • Lower Sorbian (dsb)
  • Duala (dua)
  • Divehi (dv)
  • Jola-Fonyi (dyo)
  • Dzongkha (dz)
  • Embu (ebu)
  • Ewe (ee)
  • Greek (modern) (el)
  • English (en)
  • Esperanto (eo)
  • Spanish (es)
  • Estonian (et)
  • Basque (eu)
  • Ewondo (ewo)
  • Persian (fa)
  • Fulah (ff)
  • Finnish (fi)
  • Filipino (fil)
  • Faroese (fo)
  • French (fr)
  • Friulian (fur)
  • Western Frisian (fy)
  • Irish (ga)
  • Gaelic (gd)
  • Geez (gez)
  • Galician (gl)
  • Konkani (gom)
  • Swiss German (gsw)
  • Gujarati (gu)
  • Gusii (guz)
  • Manx (gv)
  • Hausa (ha)
  • Hakka Chinese (hak)
  • Hawaiian (haw)
  • Hebrew (modern) (he)
  • Hindi (hi)
  • Fiji Hindi (hif)
  • Chhattisgarhi (hne)
  • Croatian (hr)
  • Upper Sorbian (hsb)
  • Haitian (ht)
  • Hungarian (hu)
  • Armenian (hy)
  • i18n (i18n)
  • Interlingua (ia)
  • Indonesian (id)
  • Igbo (ig)
  • Sichuan Yi (ii)
  • Inupiaq (ik)
  • in (in)
  • Icelandic (is)
  • Italian (it)
  • Inuktitut (iu)
  • iw (iw)
  • Japanese (ja)
  • Ngomba (jgo)
  • Machame (jmc)
  • Javanese (jv)
  • Georgian (ka)
  • Kabyle (kab)
  • Kamba (kam)
  • Makonde (kde)
  • Kabuverdianu (kea)
  • Koyra Chiini (khq)
  • Kikuyu (ki)
  • Kazakh (kk)
  • Kako (kkj)
  • Kalaallisut (kl)
  • Kalenjin (kln)
  • Central Khmer (km)
  • Kannada (kn)
  • Korean (ko)
  • Konkani (kok)
  • Kashmiri (ks)
  • Shambala (ksb)
  • Bafia (ksf)
  • Colognian (ksh)
  • Kurdish (ku)
  • Cornish (kw)
  • Kirghiz (ky)
  • Langi (lag)
  • Luxembourgish (lb)
  • Ganda (lg)
  • Limburgan (li)
  • Ligurian (lij)
  • Lakota (lkt)
  • Lingala (ln)
  • Lao (lo)
  • Northern Luri (lrc)
  • Lithuanian (lt)
  • Luba-Katanga (lu)
  • Luo (luo)
  • Luyia (luy)
  • Latvian (lv)
  • Literary Chinese (lzh)
  • Magahi (mag)
  • Maithili (mai)
  • Masai (mas)
  • Meru (mer)
  • Morisyen (mfe)
  • Malagasy (mg)
  • Makhuwa-Meetto (mgh)
  • Metaʼ (mgo)
  • Eastern Mari (mhr)
  • Maori (mi)
  • Mískito (miq)
  • Karbi (mjw)
  • Macedonian (mk)
  • Malayalam (ml)
  • Mongolian (mn)
  • Manipuri (mni)
  • mo (mo)
  • Marathi (mr)
  • Malay (ms)
  • Maltese (mt)
  • Mundang (mua)
  • Burmese (my)
  • Mazanderani (mzn)
  • Min Nan Chinese (nan)
  • Nama (naq)
  • Norwegian Bokmål (nb)
  • North Ndebele (nd)
  • Low German (nds)
  • Nepali (ne)
  • Central Nahuatl (nhn)
  • Niuean (niu)
  • Dutch (nl)
  • Kwasio (nmg)
  • Norwegian Nynorsk (nn)
  • Ngiemboon (nnh)
  • Norwegian (no)
  • South Ndebele (nr)
  • Northern Sotho (nso)
  • Nuer (nus)
  • Nyankole (nyn)
  • Occitan (oc)
  • Oromo (om)
  • Oriya (or)
  • Ossetian (os)
  • Panjabi (pa)
  • Papiamento (pap)
  • Polish (pl)
  • Prussian (prg)
  • Pashto (ps)
  • Portuguese (pt)
  • Quechua (qu)
  • Cusco Quechua (quz)
  • Rajasthani (raj)
  • Romansh (rm)
  • Rundi (rn)
  • Romanian (ro)
  • Rombo (rof)
  • Russian (ru)
  • Kinyarwanda (rw)
  • Rwa (rwk)
  • Sanskrit (sa)
  • Sakha (sah)
  • Samburu (saq)
  • Santali (sat)
  • Sangu (sbp)
  • Sardinian (sc)
  • Sindhi (sd)
  • Northern Sami (se)
  • Sena (seh)
  • Koyraboro Senni (ses)
  • Sango (sg)
  • Samogitian (sgs)
  • sh (sh)
  • Tachelhit (shi)
  • Shan (shn)
  • Shuswap (shs)
  • Sinhala (si)
  • Sidamo (sid)
  • Slovak (sk)
  • Slovene (sl)
  • Samoan (sm)
  • Inari Sami (smn)
  • Shona (sn)
  • Somali (so)
  • Albanian (sq)
  • Serbian (sr)
  • Swati (ss)
  • Southern Sotho (st)
  • Swedish (sv)
  • Swahili (sw)
  • Silesian (szl)
  • Tamil (ta)
  • Tulu (tcy)
  • Telugu (te)
  • Teso (teo)
  • Tetum (tet)
  • Tajik (tg)
  • Thai (th)
  • Chitwania Tharu (the)
  • Tigrinya (ti)
  • Tigre (tig)
  • Turkmen (tk)
  • Tagalog (tl)
  • Klingon (tlh)
  • Tswana (tn)
  • Tongan (Tonga Islands) (to)
  • Tok Pisin (tpi)
  • Turkish (tr)
  • Tsonga (ts)
  • Tatar (tt)
  • Tasawaq (twq)
  • Talossan (tzl)
  • Tamazight (tzm)
  • Uighur (ug)
  • Ukrainian (uk)
  • Unami (unm)
  • Urdu (ur)
  • Uzbek (uz)
  • Vai (vai)
  • Venda (ve)
  • Vietnamese (vi)
  • Volapük (vo)
  • Vunjo (vun)
  • Walloon (wa)
  • Walser (wae)
  • Wolaytta (wal)
  • Wolof (wo)
  • Xhosa (xh)
  • Soga (xog)
  • Yangben (yav)
  • Yiddish (yi)
  • Yoruba (yo)
  • Cantonese (yue)
  • Yau (Morobe Province) (yuw)
  • Standard Moroccan Tamazight (zgh)
  • Chinese (zh)
  • Zulu (zu)

Usage

The Date class extends the Carbon methods such as format and diffForHumans, and translates them based on your locale:

use Jenssegers\Date\Date;

Date::setLocale('nl');

echo Date::now()->format('l j F Y H:i:s'); // zondag 28 april 2013 21:58:16

echo Date::parse('-1 day')->diffForHumans(); // 1 dag geleden

The Date class also added some aliases and additional methods such as: ago which is an alias for diffForHumans, and the timespan method:

echo $date->timespan(); // 3 months, 1 week, 1 day, 3 hours, 20 minutes

Methods such as parse and createFromFormat also support "reverse translations". When calling these methods with translated input, it will try to translate it to English before passing it to DateTime:

$date = Date::createFromFormat('l d F Y', 'zaterdag 21 maart 2015');

Carbon

Carbon is the library the Date class is based on. All of the original Carbon operations are still available, check out https://carbon.nesbot.com/docs for more information. Here are some of the available methods:

Creating dates

You can create Date objects just like the DateTime object (http://www.php.net/manual/en/datetime.construct.php):

$date = new Date();
$date = new Date('2000-01-31');
$date = new Date('2000-01-31 12:00:00');

// With time zone
$date = new Date('2000-01-31', new DateTimeZone('Europe/Brussels'));

You can skip the creation of a DateTimeZone object:

$date = new Date('2000-01-31', 'Europe/Brussels');

Create Date objects from a relative format (http://www.php.net/manual/en/datetime.formats.relative.php):

$date = new Date('now');
$date = new Date('today');
$date = new Date('+1 hour');
$date = new Date('next monday');

This is also available using these static methods:

$date = Date::parse('now');
$date = Date::now();

Creating a Date from a timestamp:

$date = new Date(1367186296);

Or from an existing date or time:

$date = Date::createFromDate(2000, 1, 31);
$date = Date::createFromTime(12, 0, 0);
$date = Date::create(2000, 1, 31, 12, 0, 0);

Formatting Dates

You can format a Date object like the DateTime object (http://www.php.net/manual/en/function.date.php):

echo Date::now()->format('Y-m-d'); // 2000-01-31

The Date object can be cast to a string:

echo Date::now(); // 2000-01-31 12:00:00

Get a human readable output (alias for diffForHumans):

echo $date->ago(); // 5 days ago

Calculate a timespan:

$date = new Date('+1000 days');
echo Date::now()->timespan($date);
// 2 years, 8 months, 3 weeks, 5 days

// or even
echo Date::now()->timespan('+1000 days');

Get years since date:

$date = new Date('-10 years');
echo $date->age; // 10

$date = new Date('+10 years');
echo $date->age; // -10

Manipulating Dates

You can manipulate by using the add and sub methods, with relative intervals (http://www.php.net/manual/en/datetime.formats.relative.php):

$yesterday = Date::now()->sub('1 day');
$tomorrow  = Date::now()->add('1 day');

// ISO 8601
$date = Date::now()->add('P2Y4DT6H8M');

You can access and modify all date attributes as an object:

$date->year = 2013:
$date->month = 1;
$date->day = 31;

$date->hour = 12;
$date->minute = 0;
$date->second = 0;

Contributing

Language contributions should made to https://github.com/briannesbitt/Carbon.

License

Laravel Date is licensed under The MIT License (MIT).

Security contact information

To report a security vulnerability, follow these steps.

date's People

Contributors

aiiro avatar akalongman avatar albert221 avatar asd-lt avatar atofighi avatar balping avatar frin avatar grahamcampbell avatar janbolat avatar jenssegers avatar kerryusry avatar kylekatarnls avatar limenet avatar martijnthomas avatar matthewnessworthy avatar meigwilym avatar mmestrovic avatar oscarotero avatar propaganistas avatar romanbican avatar scif avatar sendoa avatar sineld avatar siomkin avatar thangngoc89 avatar thujohn avatar topzar avatar unrulynatives avatar vinkla avatar vokomarov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

date's Issues

v2.0.12 not compatible with L4

Hi,

First of all, thank you for your great library :)

It's just to say that last version (v2.0.12) is no compatible with L4:
laravel-date-issue

For the moment i had to downgrade my version to v2.0.11

In German "ago" has to include an "n" at the end

Hey guys,

I just started using your package and like it so far, but I noticed a slight issue when using diffForHumans():
"vor 10 Monate" - this is grammatically wrong, it should be:
"vor 10 Monaten"

I fixed it by editing the de.php in the lang folder:

'ago'   => 'vor :timen',

Multi-byte substr

Hi, great package, thx for a work.
I found an issue in format() method with 'M' format character (for short month name) for russian locale. You should consider, that russian characters are 2-bytes per symbol, so expression $translated = substr($translated, 0, 3); is incorrect. So preferred to use $translated = mb_substr($translated, 0, 3);

Maybe, it's also preferred to change any string methods to mb_ equivalent for correctly work with multibyte strings. Referenced to http://php.net/manual/en/ref.mbstring.php

Regards

Feedback: rename GitHub repo

I feel like I should rename the repository to php-date instead of laravel-date as it is not limited to be used with Laravel only. What do you guys think?

ErrorException in MessageSelector.php line 85:

Hello there. Still have this error

Unable to choose a translation for "o secunda|:count secunde" with locale "ro" for value "31". Double check that this translation has the correct plural options (e.g. "There is one apple|There are %count% apples").

Laravel 5

Hi!
I would love an implementation ready for Laravel 5.

Cause it seems like it doesnt work for Laravel 5 as it is right now at least?

ErrorException after updating

  • Removing jenssegers/date (dev-master 0077c51)
  • Installing jenssegers/date (dev-master cab9999)
    Downloading: 100%

Writing lock file
Generating autoload files

[ErrorException]

Declaration of Jenssegers\Date\Date::setTranslator() should be compatible with Carbon\Carbon::setTranslator(Symfony\Component\Translation\TranslatorInterface $translator)

Script php artisan clear-compiled handling the post-update-cmd event returned with an error

[RuntimeException]
Error Output:

Standardization of months/days' name.

Hi,

I don't know if you consider it an issue, but I think that all the names of the months and days of the week should follow the same convention. Either start with a lower case or an upper case letter.

The class dont load the locale config from laravel

I was testing it and by default the class doesn't load the locale config from laravel. I can't see the code that load this config from laravel.

I fix it by putting this code on translator.php
public function __construct()
{

    if (class_exists('Illuminate\Support\Facades\Config'))
        $this->locale =\Illuminate\Support\Facades\Config::get('app.locale');

}

please! support Vietnamses lang

'ago'       => ':time trước',
'from_now'  => ':time từ bây giờ',
'after'     => ':time sau',
'before'    => ':time trước',
'year'      => '1 năm|:count năm',
'month'     => '1 tháng|:count tháng',
'week'      => '1 tuần|:count tuần',
'day'       => '1 ngày|:count ngày',
'hour'      => '1 giờ|:count giờ',
'minute'    => '1 phút|:count phút',
'second'    => '1 giây|:count giây',

'january'   => 'Tháng một',
'february'  => 'Tháng hai',
'march'     => 'Tháng ba',
'april'     => 'Tháng tư',
'may'       => 'Tháng năm',
'june'      => 'Tháng sáu',
'july'      => 'Tháng bảy',
'august'    => 'Tháng tám',
'september' => 'Tháng chín',
'october'   => 'Tháng mười',
'november'  => 'Tháng mười một',
'december'  => 'Tháng mười hai',

'monday'    => 'Thứ hai',
'tuesday'   => 'Thứ ba',
'wednesday' => 'Thứ tư',
'thursday'  => 'Thứ năm',
'friday'    => 'Thứ sáu',
'saturday'  => 'Thứ bảy',
'sunday'    => 'Chủ nhật',

PSR-2 and PSR-4

What about adding PSR-2 and PSR-4 standards to this package? What do you think @jenssegers? I could help out with that.

Is it possible to extend laravel-date?

Hi,

I tried extending laravel-date today but failed. (got plently of errors due to laravel-date not being correctly initialized)

Is it possible to extend laravel-date package?

Idea: Change on fly display of language

In english is:
Written 1 hour ago
in PL is:
Napisano 1 godzinę temu
but singular form of hour is godzina but when you want to display properly you need to change lang on the fly. You can add this :)

Would it be possible to parse a localized date?

This will create an error, but it would be nice if it would just work.

Date::setLocale('nl');
$d = Date::parse('-1 day')->format('l j F Y H:i:s'); // $d = 'zondag 22 februari 2015 09:37:23'
Date::createFromFormat('l j F Y H:i:s', $d)->toDateTimeString()

The error is, of course:

InvalidArgumentException in Carbon.php line 385:
A textual day could not be found
A textual month could not be found

Would it be possible to get this to work?

Dutch pluralization incorrect

I just noticed that there is an error in the Dutch pluralization forms of year and hour.

It might sound wierd but in the Dutch language we don't use the plural form in time indications. So '2 years ago' should not be translated to '2 jaren geleden' but to '2 jaar geleden' (in English '2 year ago').

The same accounts for '2 hours ago', this should be translated to '2 uur geleden' (2 hour ago) and not '2 uren geleden'.

I tried to find an English source but could not find one. Here you have an advice (in Dutch) from 'het Genootschap Onze Taal' an organization specialized in the Dutch language: https://onzetaal.nl/taaladvies/advies/twintig-jaar-jaren

Doesn't show translations for timestamps retrieved from database

How exactly is laravel-date supposed to work here? I don't seem to get the correct translations in from the database retrieved timestamps.

<?php
        use Jenssegers\Date\Date;
    // This returns 'vor 0 Sekunden' in German, which I do want.
    echo Date::now()->diffForHumans();
    echo '<br/>';
    // This returns '1 day ago'. It is in English, but I need it in German.
    echo $orders->find(1)->created_at->diffForHumans();
?>

I opened the case also here: http://stackoverflow.com/questions/29659683/laravel-5-jenssegers-laravel-date-doesnt-show-correct-translation-how-do-i-us

because I didn't found a tag for this package in stackoverflow, I also openend this issue here, so that I get your attention on this topic.

Thank you in advance.

Solution

composer.json:

"jenssegers/date": "2.0.21"

Hide empty date types in timespan

Is there a way to hide parts of a timespan that don't add a lot of value?

For example I have a timespan:
0 years, 0 months, 0 weeks, 0 days, 0 hours, 5 minutes, 19 seconds

I'd prefer to show it as:
5 minutes, 19 seconds

Is this possible @jenssegers? Great package by the way!

Error after updating project

I run php composer.phar update and I've got:

Declaration of Jenssegers\Date\Date::setTranslator() should be compatible with Carbon\Carbon::setTranslator

L5, update from 5.0.18 -> 5.0.21

How do i ouput time ago?

Sorry im a beginner.

I dont know how to output ago with this package

In carbon i use

$post->created_at->diffForHumans()

But what every i try here it just throws me an error

issue of zh-TW diffForHumans

in my situation is after i set Locale to zh-TW, it still show english version like 18 hours ago.
Date::setLocale('zh-TW');
$obj->created_at->diffForHumans();

but if i change $obj->created_at->diffForHumans() to Date::parse('-1 day')->diffForHumans();
it will work fine and shows '一天前'

is that a bug?? or i miss something?

[Discussion] day and month translations

In the current version, the library uses strftime to convert days and months based on the locale that is set with setlocale. It checks the format string for certain translatable characters and replaces the original date result with a translation from strftime. But this requires you set your locale.

Laravel's App::setLocale('es'); does not change the locale using setlocale, and there might be a good reason why it does not do this.

One possible solution would be to get the Laravel locale, convert it to a setlocale valid argument and set it in the service provider. A different solution would be to completely dump the strftime, and add manual translations for days an months in the language files.

Can I get some opinions on this? Maybe @tamplan or @briannesbitt?

Default use in Laravel Eloquent model

Is it possible to use this library instead of Carbon as default for timestamp fields in Laravel Eloquent models?

So one could use $post->active_at->ago() instead of Date::parse($post->active_at)->ago() in a template

Thanks!

Date::parse() bug

Date::parse() accepts timestamps, Carbon doen't.
This is cool but the timezone is wrong, always is "+00:00", you can simply use Date::createFromTimestamp() and all works as expected but this made me crazy for a while...

Thankyou!!

Error after installation

Hi,

after composer installation and adding the ServiceProvider i get the following error message:

ErrorException in Date.php line 6:
Declaration of Jenssegers\Date\Date::setTranslator() should be compatible with Carbon\Carbon::setTranslator(Symfony\Component\Translation\TranslatorInterface $translator)

What i made wrong?

(Using Laravel 5)

Drop PHP 5.3 support

Since you have integrated this with Laravel PHP 5.3 can't be supported. Laravel >=4.0 requires at least PHP ~5.4.7. Either we create separate packages for core and Laravel or remove PHP 5.3 support in this package.

This will help us create tests for the Laravel integration as well. We currently can't do that since the tests will fail due to the missing illuminate/support package.

What do you think about this @jenssegers?

How to perform declension of a date in Russian?

I am using the ->format() method to output the date in Russian language. But what I need is to perform declension at first. Because without it the date looks like this: "9 Март 2015", which is wrong according to Russian grammar. It is supposed to be "9 Марта 2015".

diffForHumans returning ":date.ago" and ":date.from_now"

Using Laravel 4.2 I'm getting the output ":date.ago" and ":date.from_now" from diffForHumans(). Locale doesn't seem to matter, and neither does the preceding method-calls. E.g.:

Date::createFromFormat('Y-m-d', '2015-12-01')->diffForHumans(); // :date.from_now
Date::tomorrow()->diffForHumans(); // :date.from_now
Date::yesterday()->diffForHumans() // :date.ago

Tried with both dev-master and 2.0.12, but no cigar.

Am I just being an idiot and missing something very obvious?

Where should I put new languages files in Laravel ?

Hi !

I'm trying to add a new language file to display 'min' instead of 'minute', etc...

I've created app/lang/altitude/date.php and tried to use Date::setLocale('altitude') or App::setLocale('altitude') but it does not seem to work.

Any idea ?

Laravel 5 support breaking Laravel 4 support

Just reporting feedback for commit #3696417

While you updated the support to Laravel 5 and tried to not break the Laravel 4 support, you unfortunately did it, explaining what you did :

if (starts_with($this->app->version(), '5'))
{
    $this->loadTranslationsFrom($this->app->basePath() . '/vendor/jenssegers/date/src/lang', 'date');
}
// Laravel 4 package registration
else
{
    $this->package('jenssegers/date');
}

But in Laravel 4 $this->app->version() method doesn't exist at all and will throw a beautiful Call to undefined method Illuminate\Foundation\Application::version(), so how we fix it, just checking if the method exists before calling it for version check :

if (method_exists($this->app, 'version') && starts_with($this->app->version(), '5'))
{
    $this->loadTranslationsFrom($this->app->basePath() . '/vendor/jenssegers/date/src/lang', 'date');
}

Please review this PR #78, tested on L5 and L4 as working, also with Travis CI.

composer require rule issue

hi

after adding "require" entry I got:
Problem 1
- The requested package jenssegers/date could not be found in any version, there may be a typo in the package name.

Can't run composer update : Jenssegers\Date\Date::diffForHumans() should be compatible with Carbon\Carbon::diffForHumans(...)

When I run composer update on my project, I have this issue :

exception 'ErrorException' with message 'Declaration of Jenssegers\Date\Date::diffForHumans() should be compatible with Carbon\Carbon::diffForHumans(Carbon\Carbon $other = NULL, $absolute = false)'

I tried on master and last tag. I think it's because any version of carbon is required "nesbot/Carbon": "*", in Jenssegers/Date's composer.json, and Carbon was released 4 hours ago.

German translation correction

Hey, i really like your package, but as a german i have some minor issues with the diffForHuman translation:

'from_now' => ':time von jetzt', should be from_now' => 'in :time',
Example: 3 Tag_e_ von jetzt should be: in 3 Tage_n_ ( notice the pluralization )
As far as i can think of, the pluralization of from_now is the same as in *_ago

I don't really know how to produce the after and before triggers, but i suspect them to be incorrect as well. (but this should be verified)
'after' => ':time nach' -> 'after' => 'nach :time' (pluralization same as *_ago)
'before' => ':time vor' -> 'before' => 'vor :time' (pluralization same as *_ago)

Thanks!

Latest Update 2.0.12 gave lang error

Just wanted to inform you, that your latest update caused an error for the language output in laravel 4.

If anyone else is having the same problem, work with 2.0.11 so far.

Encoding problem

When using the format function for french locale, some strings containing special chars are not displayed correctly (Ex: Août). My encoding seems correct. I can print some strings correctly in other section on my website. This only happens when using the 'format' method. I use UTF-8.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.