Class: Duration filter:ngeoDuration

ngeo.misc.module:filters.Duration

new Duration(gettextCatalog)

A filter used to format a time duration in seconds into a more readable form. Only the two largest units will be shown.

Examples: {{42 | ngeoDuration}} => 42 seconds {{132 | ngeoDuration}} => 2 minutes 12 seconds {{3910 | ngeoDuration}} => 1 hour 5 minutes -> Note: the remaining 10 seconds will be dropped

Parameters:
Name Type Description
gettextCatalog angularGettext.Catalog

Gettext catalog.

Returns:
ngeox.duration

Function used to format a time duration in seconds into a string.

Methods

(inner) pluralize(amount, unit)

Parameters:
Name Type Description
amount number

Amount of time.

unit symbol

Unit of time.

Returns:
string

formatted and translated string

(inner) result(duration)

Parameters:
Name Type Description
duration number

The duration in seconds.

Returns:
string

The formatted string.