{"id":23301602,"url":"https://github.com/jdforsythe/angular-moment-format-filters","last_synced_at":"2026-04-26T23:31:24.623Z","repository":{"id":58246271,"uuid":"56625047","full_name":"jdforsythe/angular-moment-format-filters","owner":"jdforsythe","description":"A set of Angular display filters for working with Moment JS dates and times","archived":false,"fork":false,"pushed_at":"2017-05-24T19:25:44.000Z","size":47,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-02-07T13:50:25.657Z","etag":null,"topics":["angular","angular-directive","angular-directives","angular-display-filters","angularjs","conversion","filter","momentjs","timestamp"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jdforsythe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-04-19T19:19:09.000Z","updated_at":"2016-04-19T19:19:34.000Z","dependencies_parsed_at":"2022-08-31T00:21:38.232Z","dependency_job_id":null,"html_url":"https://github.com/jdforsythe/angular-moment-format-filters","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/jdforsythe/angular-moment-format-filters","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdforsythe%2Fangular-moment-format-filters","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdforsythe%2Fangular-moment-format-filters/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdforsythe%2Fangular-moment-format-filters/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdforsythe%2Fangular-moment-format-filters/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jdforsythe","download_url":"https://codeload.github.com/jdforsythe/angular-moment-format-filters/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdforsythe%2Fangular-moment-format-filters/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32317162,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T23:26:28.701Z","status":"ssl_error","status_checked_at":"2026-04-26T23:26:25.802Z","response_time":129,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular","angular-directive","angular-directives","angular-display-filters","angularjs","conversion","filter","momentjs","timestamp"],"created_at":"2024-12-20T10:14:39.495Z","updated_at":"2026-04-26T23:31:24.600Z","avatar_url":"https://github.com/jdforsythe.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"angular-moment-format-filters\n==============================\n\n[![Build Status](https://travis-ci.org/jdforsythe/angular-moment-format-filters.svg?branch=master)](https://travis-ci.org/jdforsythe/angular-moment-format-filters)\n\nA set of Angular display filters for use with the [Moment.js](http://momentjs.com) and [Moment Timezone](http://moment.js/timezone) libraries\n\n## Dependencies\n1. Angular (`bower install -S angular`)\n2. Moment JS (`bower install -S moment`)\n3. Moment Timezone (optional - for use with the timezone conversion filters - `bower install -S moment-timezone`)\n\n## Installation\n```bash\n$ bower install angular-moment-format-filters\n```\n\n## Setup\n\nInclude `angular-moment-format-filters'` in your module's dependencies:\n\n```js\nangular.module('myApp', ['angular-moment-format-filters']);\n```\n\nAnd add the dependencies as script tags:\n\n```html\n\u003cscript src=\"bower_components/angular/angular.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"bower_components/moment/moment.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"bower_components/moment-timezone/builds/moment-timezone-with-data-2010-2020.js\"\u003e\u003c/script\u003e\n```\n\n## Examples\n\nTo see the examples below in action, check out the [Fiddle](https://jsfiddle.net/jdforsythe/mjq5whk5/1/)\n## Filters\n\nThere are two pairs of filters.\n\n1. `momentFormat` and `momentFormatServerTimestamp`\n2. `momentFromNow` and `momentFromNowServerTimestamp`\n\n### momentFormat Filter\n\nThe `momentFormat` filter will format a moment-able object (string, JS Date object, existing moment object, etc.) based on the [Moment format string](http://momentjs.com/docs/#/displaying/format).\n\nParameters to the filter are:\n  - formatString (required) - [Moment format string](http://momentjs.com/docs/#/displaying/format)\n  - hideErrors (optional - default false) - whether to suppress errors (returns empty string on invalid date input)\n\n\n```js\n$scope.date_one = '2016-01-18';\n$scope.date_two = new Date(2016, 0, 18);\n$scope.date_three = moment('2016-01-18');\n$scope.date_four = moment(null);\n```\n\n```html\n\u003cp\u003e{{ date_one | momentFormat:'MM/DD/YYYY' }}\u003c/p\u003e\n\u003cp\u003e{{ date_two | momentFormat:'DD/MM/YYYY' }}\u003c/p\u003e\n\u003cp\u003e{{ date_three | momentFormat:'MMMM Do, YYYY' }}\u003c/p\u003e\n\u003cp\u003e{{ date_four | momentFormat:'MM/DD/YYYY',false }}\u003c/p\u003e\n\u003cp\u003e{{ date_four | momentFormat:'MM/DD/YYYY',true }}\u003c/p\u003e\n```\n\n```\n01/18/2016\n18/01/2016\nJanuary 18th, 2016\nInvalid Date\n[empty string]\n```\n\n### momentFromNow Filter\n\nThe `momentFromNow` filter will format a moment-able object (string, JS Date object, existing moment object, etc.) as a [human-readable time difference from now](http://momentjs.com/docs/#/displaying/fromnow).\n\nParameter to the filter:\n  - hideErrors (optional - default false) - whether to suppress errors (returns empty string on invalid date input)\n\n```js\n$scope.date_one = new Date();\n$scope.date_two = '2016-04-19 15:04:00';\n$scope.date_three = moment('2015-04-19');\n$scope.date_four = moment(null);\n```\n\n```html\n\u003cp\u003e{{ date_one | momentFromNow }}\u003c/p\u003e\n\u003cp\u003e{{ date_two | momentFromNow }}\u003c/p\u003e\n\u003cp\u003e{{ date_three | momentFromNow }}\u003c/p\u003e\n\u003cp\u003e{{ date_four | momentFromNow }}\u003c/p\u003e\n\u003cp\u003e{{ date_four | momentFromNow:true }}\u003c/p\u003e\n```\n\n```\na few seconds ago\nan hour ago\na year ago\nInvalid Date\n[empty string]\n```\n\n### ServerTimestamp filter varieties\n\nIn many cases, when using timestamps in a database, the timestamps will be stored in UTC time (or some other base time) and the users are in different timezones.\nThe Moment Timezone library makes it easy to convert times across timezones.\n\nTo set the proper timezones, configure the filters:\n\n```js\nangular.module('myApp', ['angular-moment-format-filters'])\n.config(function(momentFormatConfigProvider) {\n  momentFormatConfigProvider.setConfig({\n    localTimezone: 'America/New_York',\n    serverTimezone: 'America/Los_Angeles'\n  });\n});\n```\n\n#### Config Options\n\n* `localTimezone`: (string) the standard timezone string for the _end user_ (i.e. browser timezone)\n  * default: `'Etc/UTC'`\n* `serverTimezone`: (string) the standard timezone string for the _server_\n  * default: `'Etc/UTC'`\n\nConversions will be made *from* `serverTimezone`, *to* `localTimezone`\n\n#### Example\n\nAssuming the configuration example provided above...\n\n```js\n$scope.server_timestamp_one = '2016-01-18 12:00:00';\n$scope.server_timestamp_two = '2016-04-19 12:16:00';\n```\n\n```html\n\u003cp\u003e{{ server_timestamp_one | momentFormatServerTimestamp:'MM/DD/YYYY HH:mm' }}\u003c/p\u003e\n\u003cp\u003e{{ server_timestamp_two | momentFromNowServerTimestamp }}\u003c/p\u003e\n```\n\n```\n01/18/2016 15:00 (converted 12:00pm Pacific to 3:00pm Eastern)\na minute ago (assuming it's 3:17pm Eastern, 12:16pm Pacific is a minute ago)\n```\n\n## Tests\n\nA round of tests is included. To run the tests, execute:\n\n```\ngulp test\n```\n\n## Contributions\n\nContributions are always welcome. Please submit issues and pull requests.\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjdforsythe%2Fangular-moment-format-filters","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjdforsythe%2Fangular-moment-format-filters","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjdforsythe%2Fangular-moment-format-filters/lists"}