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

Calendar() feature request #29

Closed
hirbod opened this issue Dec 20, 2014 · 3 comments
Closed

Calendar() feature request #29

hirbod opened this issue Dec 20, 2014 · 3 comments

Comments

@hirbod
Copy link

hirbod commented Dec 20, 2014

Hi @fightbulc,

I'm building something similar like the facebook timeline. It would be nice if you could add an optional feature for the calendar. I would like to have the ability to set an optional feature for "today". Instead of showing "today at xxx" I'd like to have "1 hour ago, 2 hours ago" till 8 hours ago, after this, when not > 0 o'clock, showing today at XXX.

I think this would be a very helpful and nice feature request. What you think?

@Senorsen
Copy link
Contributor

👍 +1

@fightbulc
Copy link
Owner

Hey to the both of you. You know that there is a relativeTime feature?

$m = new Moment('2015-05-03T10:00:00', 'Europe/Berlin');
echo $m->fromNow()->getRelative(); // 4 hours ago

Depending on the difference of the two moments you will receive one of the following options (see locale files):

array(
    "future" => 'in %s',
    "past"   => '%s ago',
    "s"      => 'a few seconds',
    "m"      => 'a minute',
    "mm"     => '%d minutes',
    "h"      => 'an hour',
    "hh"     => '%d hours',
    "d"      => 'a day',
    "dd"     => '%d days',
    "M"      => 'a month',
    "MM"     => '%d months',
    "y"      => 'a year',
    "yy"     => '%d years',
);

@hirbod
Copy link
Author

hirbod commented Jun 14, 2015

PERFECT! THANKS!

@hirbod hirbod closed this as completed Jun 14, 2015
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

3 participants