{"id":19399001,"url":"https://github.com/aurbano/angular-timespan","last_synced_at":"2025-10-30T07:51:06.379Z","repository":{"id":31159750,"uuid":"34719853","full_name":"aurbano/angular-timespan","owner":"aurbano","description":"Simple directive to get human readable timespans from any two dates","archived":false,"fork":false,"pushed_at":"2015-06-16T13:06:41.000Z","size":144,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-07T11:52:27.297Z","etag":null,"topics":["angular","bower","human-readable-timespans","javascript","npm-package"],"latest_commit_sha":null,"homepage":"https://aurbano.github.io/angular-timespan","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aurbano.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-04-28T08:59:03.000Z","updated_at":"2019-12-18T21:11:30.000Z","dependencies_parsed_at":"2022-08-27T08:30:53.479Z","dependency_job_id":null,"html_url":"https://github.com/aurbano/angular-timespan","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aurbano%2Fangular-timespan","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aurbano%2Fangular-timespan/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aurbano%2Fangular-timespan/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aurbano%2Fangular-timespan/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aurbano","download_url":"https://codeload.github.com/aurbano/angular-timespan/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240572156,"owners_count":19822603,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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","bower","human-readable-timespans","javascript","npm-package"],"created_at":"2024-11-10T11:07:54.370Z","updated_at":"2025-10-30T07:51:01.346Z","avatar_url":"https://github.com/aurbano.png","language":"JavaScript","readme":"# angular-timespan\n\u003e Simple directive to get human readable timespans from any two dates\n\n## Install\n\n```bash\nbower install angular-timespan\n```\n\nOr download the [full file](https://github.com/aurbano/angular-timespan/blob/master/dist/angular-timespan.js) or the [minified version](https://github.com/aurbano/angular-timespan/blob/master/dist/angular-timespan.min.js) from the [dist folder](https://github.com/aurbano/angular-timespan/tree/master/dist).\n\nThen include the file in your application (adding the script tag, using require... ) and add it to your app:\n\n```js\nangular.module('myApp',[\n        'aurbano.timespan'\n        // ...\n].run([\n  /* ... */\n]);\n```\n\n## Usage\nAdd the directive with the difference between any two dates to get them in a readable manner:\n\n```html\nSent \u003cspan timespan=\"dateDiff\"\u003e\u003c/span\u003e ago.\n\n\u003c!-- Generates (for example): --\u003e\nSent 14 days ago\n```\n\nWhere dateDiff is the difference in milliseconds: `$scope.dateDiff = new Date() - startDate;`\n\n## Options\nYou can specify `timespan-opts` with an object containing the custom settings you want for the timespan display:\n\n```html\nSent \u003cspan timespan=\"dateDiff\" timespan-opts=\"timespanConfig\"\u003e\u003c/span\u003e ago.\n```\n\nAnd in your controller:\n\n```js\n$scope.timespanConfig = {\n    lessThanFirst: 'now',   // What to display if the diff is less than the first available unit\n    millisecond: 'ms',      // ------------------------------------\n    second: 's',            // \n    minute: 'm',            // \n    hour: 'h',              // Labels for each unit, use them for\n    day: 'd',               // shorthand units, localization...\n    week: 'w',              // Set any to `false` to disable it\n    month: 'mo',            //\n    year: 'y',              // ------------------------------------\n    space: false,           // Whether to add a space between the number and the label\n    pluralize: false        // Whether to add an 's' to the label if the diff \u003e 1\n};\n```\n\n## Contribute\nFeel free to submit any issues or modifications in Pull Requests. If you are adding a feature it would be great if you also documented it in the Readme, or at least in the PR comment.\n\n## License\nThis directive is released under the [MIT License](https://github.com/aurbano/angular-timespan/blob/master/LICENSE)\n\n-------\n*Developed by [Alejandro U. Alvarez](http://urbanoalvarez.es)*\n\n[![Analytics](https://ga-beacon.appspot.com/UA-3181088-16/angular-timespan/readme)](https://github.com/aurbano)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faurbano%2Fangular-timespan","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faurbano%2Fangular-timespan","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faurbano%2Fangular-timespan/lists"}