Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't show translations for timestamps retrieved from database #123

Closed
LoveAndHappiness opened this issue Apr 15, 2015 · 6 comments
Closed

Comments

@LoveAndHappiness
Copy link

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.

@The-Hasanov
Copy link
Contributor

@LoveAndHappiness
Copy link
Author

Where do I put this file?

@The-Hasanov
Copy link
Contributor

change your model this example

@LoveAndHappiness
Copy link
Author

Which model? Order Model I suggest, (or every model where I am going to retrieve timestamps)?

@Propaganistas
Copy link
Contributor

Yes, in every model where you're going to retrieve timestamps. Basically the freshTimestamps() and asDateTime() methods are overriding the default Eloquent methods with nearly identical code. The only difference is Carbon being swapped out for Date.

@EmilioBravo
Copy link

@LoveAndHappiness check this #144

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants