{"id":42654052,"url":"https://github.com/go-follow/time-interval","last_synced_at":"2026-01-29T07:46:48.204Z","repository":{"id":44114827,"uuid":"303034086","full_name":"go-follow/time-interval","owner":"go-follow","description":"Working at regular intervals using golang","archived":false,"fork":false,"pushed_at":"2022-05-21T04:51:59.000Z","size":37,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-08-26T09:05:02.195Z","etag":null,"topics":["go","golang","interval","mit","span","time"],"latest_commit_sha":null,"homepage":"","language":"Go","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/go-follow.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":"2020-10-11T03:24:35.000Z","updated_at":"2023-06-04T12:25:24.000Z","dependencies_parsed_at":"2022-09-26T18:41:08.417Z","dependency_job_id":null,"html_url":"https://github.com/go-follow/time-interval","commit_stats":null,"previous_names":[],"tags_count":8,"template":null,"template_full_name":null,"purl":"pkg:github/go-follow/time-interval","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-follow%2Ftime-interval","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-follow%2Ftime-interval/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-follow%2Ftime-interval/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-follow%2Ftime-interval/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/go-follow","download_url":"https://codeload.github.com/go-follow/time-interval/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-follow%2Ftime-interval/sbom","scorecard":{"id":431781,"data":{"date":"2025-08-11","repo":{"name":"github.com/go-follow/time-interval","commit":"5dd1161aa43efa1fab856afb29c0ddb1e06d2f94"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"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":"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":"Code-Review","score":0,"reason":"Found 0/24 approved changesets -- score normalized to 0","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":"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/ci.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/go-follow/time-interval/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/go-follow/time-interval/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/go-follow/time-interval/ci.yml/master?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction 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":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.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":"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":"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":"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":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 8 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-19T03:32:25.905Z","repository_id":44114827,"created_at":"2025-08-19T03:32:25.905Z","updated_at":"2025-08-19T03:32:25.905Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28870646,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-29T07:35:32.468Z","status":"ssl_error","status_checked_at":"2026-01-29T07:33:31.463Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["go","golang","interval","mit","span","time"],"created_at":"2026-01-29T07:46:47.452Z","updated_at":"2026-01-29T07:46:48.183Z","avatar_url":"https://github.com/go-follow.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# time-interval [![godoc](https://img.shields.io/badge/godoc-reference-green.svg?style=flat)](https://godoc.org/github.com/go-follow/time-interval) [![license](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](https://github.com/go-follow/time-interval/blob/master/LICENSE)\n\nThis package helps to work with time intervals. The functionality allows you to perform the following basic operations:\n* Union - merging of time intervals\n* Intersection - finding intersections of regular intervals\n* Except - differentiation between fixed intervals\n* Equal - comparison of time intervals\n* IsIntersection - check for intersection of time intervals\n\n## install\n```\ngo get github.com/go-follow/time-interval\n\n```\n## usage\nTo start using the functionality, you need to initialize a time slot or time slots.\nAttention: when initializing intervals, it is important to know that the end date of \nthe interval must be greater than the start date of the interval.\n\nAn example of using a package\n```go\npackage main\n \nimport (\n    \"fmt\"\n    \"time\"\n\n    interval \"github.com/go-follow/time-interval\"\n)\n\nfunc main() {\n    timeStart1 := time.Date(2020, 10, 17, 10, 0, 0, 0, time.UTC)\n    timeEnd1 := time.Date(2020, 10, 17, 15, 0, 0, 0, time.UTC)\n    timeStart2 := time.Date(2020, 10, 17, 14, 0, 0, 0, time.UTC)\n    timeEnd2 := time.Date(2020, 10, 17, 19, 0, 0, 0, time.UTC)\n    \n    newInt, err := interval.New(timeStart1, timeEnd1)\n    if err != nil {\n        log.Fatal(err)\n    }\n    newInt2, err := interval.New(timeStart2, timeEnd2)\n    if err != nil {\n        log.Fatal(err)\n    }\n    \n    newIntMany := interval.NewMany(newInt, newInt2)\n    result := newIntMany.Union()\n    fmt.Println(result.String()) // 2020-10-17 10:00:00 +0000 UTC - 2020-10-17 19:00:00 +0000 UTC\n}\n```\n## examples\n* Except\n\nFor the Except operation, it is important where the subtraction comes from.\nFor SpanMany, before returning the final result, is sorted and merged\n```go\npackage main\n \nimport (\n    \"fmt\"\n    \"time\"\n\n    interval \"github.com/go-follow/time-interval\"\n)\n\nfunc main() {\n    timeStart1 := time.Date(2020, 10, 18, 9, 0, 0, 0, time.UTC)\n    timeEnd1 := time.Date(2020, 10, 18, 12, 0, 0, 0, time.UTC)\n    timeStart2 := time.Date(2020, 10, 18, 11, 0, 0, 0, time.UTC)\n    timeEnd2 := time.Date(2020, 10, 18, 15, 0, 0, 0, time.UTC)\n\n    ti1, err := interval.New(timeStart1, timeEnd1)\n    if err != nil {\n        log.Fatal(err)\n    }\n    ti2, err := interval.New(timeStart2, timeEnd2)\n    if err != nil {\n        log.Fatal(err)\n    }\n    \n    // ti1 \\ ti2\n    ti1ExceptTi2 := ti1.Except(ti2)\n    fmt.Println(ti1ExceptTi2.String()) // [ 2020-10-18 10:00:00 +0000 UTC - 2020-10-18 11:00:00 +0000 UTC ]\n    \n    // ti2 \\ ti1\n    ti2ExceptTi1 := ti2.Except(ti1)\n    fmt.Println(ti2ExceptTi1.String()) // [ 2020-10-18 12:00:00 +0000 UTC - 2020-10-18 15:00:00 +0000 UTC ]\n\n    ti1, err := interval.New(time.Date(2020, 10, 18, 7, 0, 0, 0, time.UTC), time.Date(2020, 10, 18, 10, 0, 0, 0, time.UTC))\n    if err != nil {\n        log.Fatal(err)\n    }\n    ti2, err := interval.New(time.Date(2020, 10, 18, 14, 0, 0, 0, time.UTC), time.Date(2020, 10, 18, 15, 0, 0, 0, time.UTC))\n    if err != nil {\n        log.Fatal(err)\n    }\n    ti3, err := interval.New(interval.New(time.Date(2020, 10, 18, 12, 0, 0, 0, time.UTC), time.Date(2020, 10, 18, 16, 0, 0, 0, time.UTC))\n    if err != nil {\n        log.Fatal(err)\n    }\n    ti4, err := interval.New(time.Date(2020, 10, 18, 12, 0, 0, 0, time.UTC), time.Date(2020, 10, 18, 14, 30, 0, 0, time.UTC))\n    if err != nil {\n        log.Fatal(err)\n    }\n    ti5, err := interval.New(time.Date(2020, 10, 18, 14, 33, 0, 0, time.UTC), time.Date(2020, 10, 18, 18, 0, 0, 0, time.UTC)),\n    if err != nil {\n        log.Fatal(err)\n    }\n    // Except for SpanMany\n    intervalMany := interval.NewMany(ti1, ti2, ti3, ti4, ti5)\n    intervalInput, err := interval.New(time.Date(2020, 10, 18, 14, 0, 0, 0, time.UTC), time.Date(2020, 10, 18, 15, 0, 0, 0, time.UTC))\n    if err != nil {\n        log.Fatal(err)\n    }\n    exceptMany := intervalMany.Except(intervalInput)\n\n    // [\n    //    2020-10-18 07:00:00 +0000 UTC - 2020-10-18 10:00:00 +0000 UTC\n    //    2020-10-18 12:00:00 +0000 UTC - 2020-10-18 14:00:00 +0000 UTC\n    //    2020-10-18 15:00:00 +0000 UTC - 2020-10-18 18:00:00 +0000 UTC\n    // ]\n\n    fmt.Println(exceptMany.String())         \t\t\t\t    \t\t\t     \n}\n```\n* Union\n\nfor SpanMany union operation concatenates and sorts the original result\n```go\npackage main\n \nimport (\n    \"fmt\"\n    \"time\"\n\n    interval \"github.com/go-follow/time-interval\"\n)\n\nfunc main() {\n    timeStart1 := time.Date(2020, 10, 17, 12, 0, 0, 0, time.UTC)\n    timeEnd1 := time.Date(2020, 10, 17, 14, 0, 0, 0, time.UTC)\n    timeStart2 := time.Date(2020, 10, 17, 22, 0, 0, 0, time.UTC)\n    timeEnd2 := time.Date(2020, 10, 17, 23, 0, 0, 0, time.UTC)\n    timeStart3 := time.Date(2020, 10, 17, 13, 0, 0, 0, time.UTC)\n    timeEnd3 := time.Date(2020, 10, 17, 17, 0, 0, 0, time.UTC)\n    timeStart4 := time.Date(2020, 10, 17, 7, 0, 0, 0, time.UTC)\n    timeEnd4 :=  time.Date(2020, 10, 17, 10, 0, 0, 0, time.UTC)\n    timeStart5 := time.Date(2020, 10, 17, 21, 0, 0, 0, time.UTC)\n    timeEnd5 := time.Date(2020, 10, 17, 23, 0, 0, 0, time.UTC)\n    timeStart6 := time.Date(2020, 10, 17, 11, 0, 0, 0, time.UTC)\n    timeEnd6 := time.Date(2020, 10, 17, 15, 0, 0, 0, time.UTC)\n    \n    timeSpan, err := interval.New(timeStart1, timeEnd1)\n    if err != nil {\n        log.Fatal(err)\n    }\n    timeInput2, err := interval.New(timeStart2, timeEnd2)\n    if err != nil {\n        log.Fatal(err)\n    }\n    timeInput3, err := interval.New(timeStart3, timeEnd3)\n    if err != nil {\n        log.Fatal(err)\n    }\n    result := timeSpan.Union(timeInput)\n\n    // [\n    //\t2020-10-17 12:00:00 +0000 UTC - 2020-10-17 17:00:00 +0000 UTC\n    // ]\n    fmt.Println(result.String())\n\n   \n\n    timeSpanMany1 := interval.NewMany(\n        timeSpan,\n        timeInput2,\n        timeInput3\n    )\n    timeSpanMany2 := interval.NewMany()\n    if err := timeSpanMany2.Add(timeStart4, timeEnd4); err != nil {\n        log.Fatal(err)\n    }\n    timeInput5, err := interval.New(timeStart5, timeEnd5)\n    if err != nil {\n        log.Fatal(err)\n    }\n    timeInput6, err := interval.New(timeStart6, timeEnd6)\n    if err != nil {\n        log.Fatal(err)\n    }\n    timeSpanMany2.AddMany(timeInput5, timeInput6)\n\n    resultMany := timeSpanMany1.Union(timeSpanMany2)\n\n    // [\n    //\t2020-10-17 07:00:00 +0000 UTC - 2020-10-17 10:00:00 +0000 UTC\n    //\t2020-10-17 11:00:00 +0000 UTC - 2020-10-17 17:00:00 +0000 UTC\n    //\t2020-10-17 21:00:00 +0000 UTC - 2020-10-17 23:00:00 +0000 UTC\n    // ]\n\n    fmt.Println(resultMany.String())  \n        \t\t\t\t    \t\t\t     \n}\n```\n* Intersection\n```go\npackage main\n \nimport (\n    \"fmt\"\n    \"time\"\n\n    interval \"github.com/go-follow/time-interval\"\n)\n\nfunc main() {\n    timeStart1 := time.Date(2020, 10, 17, 7, 0, 0, 0, time.UTC)\n    timeEnd1 := time.Date(2020, 10, 17, 12, 0, 0, 0, time.UTC)\n    timeStart2 := time.Date(2020, 10, 17, 10, 0, 0, 0, time.UTC)\n    timeEnd2 := time.Date(2020, 10, 17, 15, 0, 0, 0, time.UTC)\n    timeStart3 := time.Date(2020, 10, 17, 20, 0, 0, 0, time.UTC)\n    timeEnd3 := time.Date(2020, 10, 17, 22, 0, 0, 0, time.UTC)\n    timeStart4 := time.Date(2020, 10, 17, 18, 0, 0, 0, time.UTC)\n    timeEnd4 :=\ttime.Date(2020, 10, 17, 23, 0, 0, 0, time.UTC)\n    timeStart5 := time.Date(2020, 10, 17, 7, 0, 0, 0, time.UTC)\n    timeEnd5 := time.Date(2020, 10, 17, 10, 0, 0, 0, time.UTC)\n\n    newInt, err := interval.New(timeStart1, timeEnd1)\n    if err != nil {\n        log.Fatal(err)\n    }\n    newInt2, err := interval.New(timeStart2, timeEnd2)\n    if err != nil {\n        log.Fatal(err)\n    }\n\n    result := newInt.Intersection(newInt2)\n    fmt.Println(result.String()) // 2020-10-17 10:00:00 +0000 UTC - 2020-10-17 12:00:00 +0000 UTC\n\n    timeStartInput := time.Date(2020, 10, 17, 10, 0, 0, 0, time.UTC)\n    timeEndInput := time.Date(2020, 10, 17, 19, 0, 0, 0, time.UTC)\n    intervalInput, err := interval.New(timeStartInput, timeEndInput)\n    if err != nil {\n        log.Fatal(err)\n    }\n    newInt3, err := interval.New(timeStart3, timeEnd3)\n    if err != nil {\n        log.Fatal(err)\n    }\n    newInt4, err := interval.New(timeStart4, timeEnd4)\n    if err != nil {\n        log.Fatal(err)\n    }\n    newInt5, err := interval.New(timeStart5, timeEnd5)\n    if err != nil {\n        log.Fatal(err)\n    }\n    timeSpanMany := interval.NewMany(newInt, newInt2, newInt3, newInt4, newInt5)\n    resultMany := timeSpanMany.Intersection(intervalInput)\n    // [\n    //\t2020-10-17 10:00:00 +0000 UTC - 2020-10-17 12:00:00 +0000 UTC\n    //\t2020-10-17 10:00:00 +0000 UTC - 2020-10-17 15:00:00 +0000 UTC\n    //\t2020-10-17 18:00:00 +0000 UTC - 2020-10-17 19:00:00 +0000 UTC\n    // ]\n    fmt.Println(resultMany.String())   \n}\n```\n* Equal\n\nIt is possible to pass an optional argument offset, which gives the possibility of a small error in the final result\n```go\npackage main\n \nimport (\n    \"fmt\"\n    \"time\"\n\n    interval \"github.com/go-follow/time-interval\"\n)\n\nfunc main() {\n    timeStart1 := time.Date(2020, 10, 18, 15, 0, 0, 0, time.UTC)\n    timeEnd1 := time.Date(2020, 10, 18, 21, 0, 0, 0, time.UTC)\n    timeStart2 := time.Date(2020, 10, 18, 14, 50, 0, 0, time.UTC)\n    timeEnd2 := time.Date(2020, 10, 18, 21, 10, 0, 0, time.UTC)\n    ti1, err := interval.New(timeStart1, timeEnd1)\n    if err != nil {\n        log.Fatal(err)\n    }\n    ti2, err := interval.New(timeStart2, timeEnd2)\n    if err != nil {\n        log.Fatal(err)\n    }\n    ti2AddSecond, err := interval.New(timeStart2, timeEnd2.Add(1 * time.Second))\n    if err != nil {\n        log.Fatal(err)\n    }\n    // Equal without offset\n    fmt.Println(ti1.Equal(ti2)) // false    \n    // Equal with offset 10 minute\n    fmt.Println(ti1.Equal(ti2, time.Minute * 10)) // true\n    // Add 1 second to ti2\n    fmt.Println(ti1.Equal(ti2AddSecond, time.Minute * 10)) // false        \n    \n    // Equal for SpanMany\n    // If there is at least one match, return true\n\n    newInt1, err := interval.New(time.Date(2020, 10, 18, 9, 0, 0, 0, time.UTC), time.Date(2020, 10, 18, 10, 0, 0, 12, time.UTC))\n    if err != nil {\n        log.Fatal(err)\n    }\n    newInt2, err := interval.New(time.Date(2020, 10, 18, 19, 0, 0, 0, time.UTC), time.Date(2020, 10, 18, 20, 0, 0, 0, time.UTC))\n    if err != nil {\n        log.Fatal(err)\n    }\n    newInt3, err := interval.New(time.Date(2020, 10, 18, 16, 55, 0, 0, time.UTC), time.Date(2020, 10, 18, 18, 0, 0, 11, time.UTC))\n    if err != nil {\n        log.Fatal(err)\n    }\n    intervalMany := interval.NewMany(newInt1, newInt2, newInt3)\n    // Equal without offset\n    intervalInput, err := interval.New(time.Date(2020, 10, 18, 17, 0, 0, 0, time.UTC), time.Date(2020, 10, 18, 18, 5, 0, 11, time.UTC))\n    if err != nil {\n        log.Fatal(err)\n    }\n    fmt.Println(intervalMany.Equal(intervalInput)) // false\n    // Equal with offset\n    fmt.Println(intervalMany.Equal(intervalInput, time.Minute * 5)) // true\n    fmt.Println(intervalMany.Equal(intervalInput, time.Minute * 4)) // false      \t\t\t\t    \t\t\t     \n}\n```\n* IsIntersection\n\nIt is possible to pass an optional argument offset, which gives the possibility of a small error in the final result\n```go\npackage main\n \nimport (\n    \"fmt\"\n    \"time\"\n\n    interval \"github.com/go-follow/time-interval\"\n)\n\nfunc main() {\n    timeStart1 := time.Date(2020, 10, 18, 17, 30, 0, 0, time.UTC)\n    timeEnd1 := time.Date(2020, 10, 18, 18, 22, 0, 0, time.UTC)\n    timeStart2 := time.Date(2020, 10, 18, 16, 0, 0, 0, time.UTC)\n    timeEnd2 := time.Date(2020, 10, 18, 17, 30, 7, 0, time.UTC)\n    ti1, err := interval.New(timeStart1, timeEnd1)\n    if err != nil {\n        log.Fatal(err)\n    }\n    ti2, err := interval.New(timeStart2, timeEnd2)\n    if err  != nil {\n        log.Fatal(err)\n    }\n    // IsIntersection without offset\n    fmt.Println(ti1.IsIntersection(ti2)) // true\n    // IsIntersection with offset 5 second\n    fmt.Println(ti1.IsIntersection(ti2, time.Second * 5)) // true\n    // IsIntersection with offset 10 second\n    fmt.Println(ti1.IsIntersection(ti2, time.Second * 10)) // false        \n    \n    // IsIntersection for SpanMany\n    // If there is at least one match, return true\n\n    newInt1, err := interval.New(time.Date(2020, 10, 18, 9, 0, 0, 0, time.UTC), time.Date(2020, 10, 18, 10, 0, 0, 0, time.UTC))\n    if err != nil {\n        log.Fatal(err)\n    }\n    newInt2, err := interval.New(time.Date(2020, 10, 18, 16, 0, 0, 0, time.UTC), time.Date(2020, 10, 18, 17, 5, 0, 0, time.UTC))\n    if err != nil {\n        log.Fatal(err)\n    }\n    newInt3, err := interval.New(time.Date(2020, 10, 18, 19, 0, 0, 0, time.UTC), time.Date(2020, 10, 18, 20, 0, 0, 0, time.UTC))\n    intervalMany := interval.NewMany(newInt1, newInt2, newInt3)\n    // IsIntersection without offset\n    intervalInput, err := interval.New(time.Date(2020, 10, 18, 17, 0, 0, 0, time.UTC), time.Date(2020, 10, 18, 18, 0, 0, 0, time.UTC))\n    if err != nil {\n        log.Fatal(err)\n    }\n    fmt.Println(intervalMany.IsIntersection(intervalInput)) // true\n    // IsIntersection with offset\n    fmt.Println(intervalMany.IsIntersection(intervalInput, time.Minute * 5)) // false\n    fmt.Println(intervalMany.IsIntersection(intervalInput, time.Minute * 3)) // true    \t\t\t\t    \t\t\t     \n}\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgo-follow%2Ftime-interval","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgo-follow%2Ftime-interval","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgo-follow%2Ftime-interval/lists"}