{"id":18712890,"url":"https://github.com/mrsteele/secondjs","last_synced_at":"2025-11-09T21:30:18.002Z","repository":{"id":65493641,"uuid":"110709748","full_name":"mrsteele/secondjs","owner":"mrsteele","description":"A second conversion utility","archived":false,"fork":false,"pushed_at":"2018-08-11T16:22:42.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-29T11:02:37.118Z","etag":null,"topics":[],"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/mrsteele.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":"2017-11-14T15:41:35.000Z","updated_at":"2018-08-11T16:22:43.000Z","dependencies_parsed_at":"2023-01-25T21:05:12.560Z","dependency_job_id":null,"html_url":"https://github.com/mrsteele/secondjs","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/mrsteele%2Fsecondjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrsteele%2Fsecondjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrsteele%2Fsecondjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrsteele%2Fsecondjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrsteele","download_url":"https://codeload.github.com/mrsteele/secondjs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239576797,"owners_count":19662113,"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":[],"created_at":"2024-11-07T12:44:17.541Z","updated_at":"2025-11-09T21:30:17.970Z","avatar_url":"https://github.com/mrsteele.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# secondjs\n\nA simple second conversion utility. It takes an `Number` (seconds) and allows you to convert that to minutes, hours, days, weeks and milliseconds.\n\n### Install\n\ninstallation is simple using npm.\n\n```\nnpm i secondjs --save\n```\n\n### Usage\n\n##### Basic example\n\nIf you would like to get started quickly, use the following as an example:\n\n```js\nconst secondjs = require('secondjs')\n\n// get the individual minutes since some other time\nconst seconds = 12345\nconsole.log(`Minutes: ${secondjs(seconds).minutes}`)\n\n// Outputs: Minutes: 205\n```\n\n##### Advanced example\n\nA simple API is provided by example:\n\n```js\nconst secondjs = require('secondjs')\n\nconst seconds = 10000000\nconst test = secondjs(seconds)\n\nconsole.log(`seconds: ${seconds}`)\nconsole.log(`minutes: ${test.minutes}`)\nconsole.log(`hours: ${test.hours}`)\nconsole.log(`days: ${test.days}`)\nconsole.log(`weeks: ${test.weeks}`)\nconsole.log(`round: ${test.round()}`)\nconsole.log(`string: ${test}`)\nconsole.log(`It has been ${secondjs(process.uptime()).round()} since this process started!`)\n\n/* Outputs:\nseconds: 10000000\nminutes: 166666\nhours: 2777\ndays: 115\nweeks: 16\nround: 16 weeks\n*/\n```\n\n##### Round\n\nThe *round* feature will use the largest time-value available by default.\n\n```js\nconst secondjs = require('secondjs')\nconsole.log(secondjs(10000).round())\n// Outputs: 2 hours\n```\n\nYou can also pass in an override and make sure the value conforms to a specific measurement:\n\n```js\nconst secondjs = require('secondjs')\nconsole.log(secondjs(10000).round('minutes'))\n// Outputs: 166 minutes\n```\nThe following arguments are allowed:\n* milliseconds\n* seconds\n* minutes\n* hours\n* days\n* weeks\n\n##### Milliseconds\n\nWe also support converting milliseconds:\n\n```js\nconst { millisecondjs } = require('secondjs')\nconsole.log(`${millisecondjs(Date.now())} since 1 January 1970 00:00:00 UTC`)\n// Output (will vary): 1510677893 seconds since 1 January 1970 00:00:00 UTC\n```\n\n### To do\n\nSince this is still in \"early-access\" I wanted to make clear some goals:\n\n* [ ] Add support for months\n  * Currently do not support this as it is non static (28-31 days)\n* [ ] Add support for years\n  * Same as month support\n* [ ] Optimize speed and memory\n  * Mainly supporting the caching of values.\n\n### License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrsteele%2Fsecondjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrsteele%2Fsecondjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrsteele%2Fsecondjs/lists"}