urish/angular-moment

BREAKING CHANGE: preprocessors, custom input format and timezone become filters

Closed this issue · 0 comments

urish commented

Currently, most of angular-moment's filters accept a preprocessor and format parameter. Over the time, the filters accumulated additional arguments, and now we have amDifferenceFilter which accepts 5 positional parameters (and another one suggested by #124 / #172).

What I have in mind for the next release (0.11.0) is a breaking change that will replace the concept of preprocessors with designated filters and will also remove support for specifying custom input date format from all the directives.

Instead, there will be designated filters that will take care of transforming string and unix-timestamp values into moments objects.

Thus, the following:

someDate | amDifference:otherDate:'minute':true:'unix':'unix'

Will become:

`someDate | amFromUnix | amDifference:(otherDate|amFromUnix):'minute':true)

Which is a little bit more verbose, but in my opinion more readable and greatly simplifies all the filters, as they will no longer have to worry about the input format and preprocessors.

Any thoughts?