{"id":21748079,"url":"https://github.com/js-sdk/js-sdk-timediff","last_synced_at":"2025-06-13T15:33:58.752Z","repository":{"id":57283614,"uuid":"103591271","full_name":"js-sdk/js-sdk-timediff","owner":"js-sdk","description":"Simple timediff utilities.","archived":false,"fork":false,"pushed_at":"2017-09-14T23:33:29.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-25T23:05:12.252Z","etag":null,"topics":["javascript","library","timediff"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/js-sdk.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-14T23:20:26.000Z","updated_at":"2017-09-15T00:45:09.000Z","dependencies_parsed_at":"2022-09-04T18:52:47.672Z","dependency_job_id":null,"html_url":"https://github.com/js-sdk/js-sdk-timediff","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/js-sdk%2Fjs-sdk-timediff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/js-sdk%2Fjs-sdk-timediff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/js-sdk%2Fjs-sdk-timediff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/js-sdk%2Fjs-sdk-timediff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/js-sdk","download_url":"https://codeload.github.com/js-sdk/js-sdk-timediff/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244723371,"owners_count":20499274,"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":["javascript","library","timediff"],"created_at":"2024-11-26T08:12:01.274Z","updated_at":"2025-03-21T02:24:05.826Z","avatar_url":"https://github.com/js-sdk.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# js-sdk-timediff\n\nSimple timediff utilities. This library has no notion of time zone.\n\n## library\n\n```ts\n$ TimeDiff(timestamp : Number) -\u003e TimeDiff\n\n// Holds the value and provide some utilities.\n\n\n$ TimeDiff::of(milliseconds : Number) -\u003e TimeDiff\n\n// Smart contructor\n\n\n$ TimeDiff.valueOf() -\u003e Number\n\n// Treat as a number so we can use the basic operation like '+'...\n\n\n$ TimeDiff.concat(b : TimeDiff) -\u003e TimeDiff\n\n// Implements semigroup for TimeDiff.\n\n\n$ TimeDiff.toDate() -\u003e Date\n\n// Returns a 'Date' from now.\n\n\n$ timeDiff(t2 : Date, t1 : Date) -\u003e TimeDiff\n\n// Returns the diff of 2 'Date's.\n\n\n$ timeDiffFromNow(t : Date) -\u003e TimeDiff\n\n// Returns the diff from now.\n\n\n$ asSeconds(tdiff : TimeDiff) -\u003e Number\n\n// Returns the number of seconds of a 'TimeDiff'.\n\n\n$ asMinutes(tdiff : TimeDiff) -\u003e Number\n\n// Returns the number of minutes of a 'TimeDiff'.\n\n\n$ asHours(tdiff : TimeDiff) -\u003e Number\n\n// Returns the number of hours of a 'TimeDiff'.\n\n\n$ asDays(tdiff : TimeDiff) -\u003e Number\n\n// Returns the number of days of a 'TimeDiff'.\n\n\n$ asMonths(tdiff : TimeDiff) -\u003e Number\n\n// Returns the number of months (speculative) of a 'TimeDiff'.\n\n\n$ asYears(tdiff : TimeDiff) -\u003e Number\n\n// Returns the number of years (no precise) of a 'TimeDiff'.\n\n\n$ asComponents(tdiff : TimeDiff) -\u003e { days: Number,\n                                      hours: Number,\n                                      minutes: Number,\n                                      seconds: Number }\n\n// Returns an object with all components (does not include year and month).\n```\n\n## license\n\nSee `license.md` or visit [Unlicense](http://unlicense.org).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjs-sdk%2Fjs-sdk-timediff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjs-sdk%2Fjs-sdk-timediff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjs-sdk%2Fjs-sdk-timediff/lists"}