urish/angular-moment

More granular amDifference filter?

Opened this issue · 11 comments

Hello!

I would love to see more granular approach with amDifference filter. For example, I want to display minutes for small differences, days for bigger differences and month for even bigger differences.

It dosn't make sense to show something like 67 days, I would prefer to show 9 weeks.

Looks like Timeago directive is working in similar fasion.

it would be even cooler to show something like 9 weeks, 4 days.

Or is it outisde of the scope of this module?

Thank you!

+1, I'd take it even a step further.

I'd love to see someone build in functionality to allow for me to set some kind of "threshold" for when amDifference should "kick over" to amCalendar or amDateFormat.

for example... would be great to have a way for me to display something in "time ago" formats for up to say, 5 days.. then kick over to a custom date format for anything longer ago than 5 days.

@RavenHursT please see this topic as well: #75

Thanks for the comments. The current interface for amDifference is already over-complicated (the filter takes up to 5 extra parameters).

I would love to see somebody comes up with a suggestion how to incorporate this features while keeping the API as simple as possible...

Maybe we could define some presets and provide them to the filter?

Something like this:

// Defining new preset via provider.
provider.addPreset('myFilterPreset', {
  fooOption: 'value',
  barOption: 'anotherValue',
  // ...
});
<!-- Passing preset name to the filter -->
{{ something|amDifference:'myFilterPreset' }}

+1
Would be good to be able to define the granularity (e.g. 2 years vs 2 years, 3 months, 15 days).

Maybe integrate with https://github.com/jsmreese/moment-duration-format

Can't we "bump" these? +1? ;-)

josx commented

👍

josx commented

I also need this feature on my work, so I decided to do it.
Any comment on this PR?

urish commented

@josx thanks for the PR, I left my comments there :)

👍

urish commented

@RavenHursT you are invited to share your thoughts in the PR (#172)