{"id":17419565,"url":"https://github.com/bendrucker/postgres-interval","last_synced_at":"2025-10-07T02:19:31.386Z","repository":{"id":33738091,"uuid":"37392719","full_name":"bendrucker/postgres-interval","owner":"bendrucker","description":"Parse Postgres interval columns","archived":false,"fork":false,"pushed_at":"2025-07-03T06:42:35.000Z","size":38,"stargazers_count":35,"open_issues_count":0,"forks_count":19,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-09-09T13:01:12.349Z","etag":null,"topics":["nodejs","postgresql"],"latest_commit_sha":null,"homepage":"","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/bendrucker.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-06-14T00:08:55.000Z","updated_at":"2025-07-03T06:42:36.000Z","dependencies_parsed_at":"2024-06-18T13:44:20.505Z","dependency_job_id":"16700739-0561-4dc8-b4fa-ab06c98aced8","html_url":"https://github.com/bendrucker/postgres-interval","commit_stats":{"total_commits":56,"total_committers":16,"mean_commits":3.5,"dds":0.4285714285714286,"last_synced_commit":"b7bcf6a14529880cc5d730b8af83b322ec8299f8"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/bendrucker/postgres-interval","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bendrucker%2Fpostgres-interval","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bendrucker%2Fpostgres-interval/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bendrucker%2Fpostgres-interval/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bendrucker%2Fpostgres-interval/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bendrucker","download_url":"https://codeload.github.com/bendrucker/postgres-interval/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bendrucker%2Fpostgres-interval/sbom","scorecard":{"id":232150,"data":{"date":"2025-08-11","repo":{"name":"github.com/bendrucker/postgres-interval","commit":"09c75cd1741b94f038fe345effff736f6973eda3"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.7,"checks":[{"name":"Maintained","score":1,"reason":"1 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":2,"reason":"Found 5/25 approved changesets -- score normalized to 2","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:5: update your workflow using https://app.stepsecurity.io/secureworkflow/bendrucker/postgres-interval/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:7: update your workflow using https://app.stepsecurity.io/secureworkflow/bendrucker/postgres-interval/test.yml/master?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/test.yml:11","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/test.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: license:0","Info: FSF or OSI recognized license: MIT License: license:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 12 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-17T05:02:30.444Z","repository_id":33738091,"created_at":"2025-08-17T05:02:30.444Z","updated_at":"2025-08-17T05:02:30.444Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278708004,"owners_count":26031932,"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","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["nodejs","postgresql"],"created_at":"2024-10-17T02:26:32.573Z","updated_at":"2025-10-07T02:19:31.370Z","avatar_url":"https://github.com/bendrucker.png","language":"JavaScript","readme":"# postgres-interval [![tests](https://github.com/bendrucker/postgres-interval/workflows/tests/badge.svg)](https://github.com/bendrucker/postgres-interval/actions?query=workflow%3Atests)\n\n\u003e Parse Postgres interval columns\n\n\n## Install\n\n```sh\nnpm install --save postgres-interval\n```\n\n\n## Usage\n\n```js\nvar parse = require('postgres-interval')\nvar interval = parse('01:02:03')\n// =\u003e { hours: 1, minutes: 2, seconds: 3 }\ninterval.toPostgres()\n// 1 hour 2 minutes 3 seconds\ninterval.toISOString()\n// P0Y0M0DT1H2M3S\ninterval.toISOStringShort()\n// PT1H2M3S\n```\n\nThis package parses the default Postgres interval style. If you have changed [`intervalstyle`](https://www.postgresql.org/docs/current/runtime-config-client.html#GUC-INTERVALSTYLE), you will need to set it back to the default:\n\n```sql\nset intervalstyle to default;\n```\n\n## API\n\n#### `parse(pgInterval)` -\u003e `interval`\n\n##### pgInterval\n\n*Required*  \nType: `string`\n\nA Postgres interval string.\n\nThis package is focused on parsing Postgres outputs. It optimizes for performance by assuming that inputs follow the default interval format. It does not perform any validation on the input. If any interval field is not found, its value will be set to `0` in the returned `interval`.\n\n#### `interval.toPostgres()` -\u003e `string`\n\nReturns an interval string. This allows the interval object to be passed into prepared statements.\n\n#### `interval.toISOString()` -\u003e `string`\n\nReturns an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#Durations) compliant string, for example `P0Y0M0DT0H9M0S`.\n\nAlso available as `interval.toISO()` for backwards compatibility.\n\n#### `interval.toISOStringShort()` -\u003e `string`\n\nReturns an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#Durations) compliant string shortened to minimum length, for example `PT9M`.\n\n## License\n\nMIT © [Ben Drucker](http://bendrucker.me)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbendrucker%2Fpostgres-interval","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbendrucker%2Fpostgres-interval","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbendrucker%2Fpostgres-interval/lists"}