{"id":17760806,"url":"https://github.com/sivaosorg/timefy","last_synced_at":"2026-02-13T05:17:29.361Z","repository":{"id":259248350,"uuid":"877411562","full_name":"sivaosorg/timefy","owner":"sivaosorg","description":"timefy is a comprehensive Go library designed to enhance productivity by offering a wide range of time-related utilities. Whether you're dealing with date formatting, time zone conversions, or scheduling. Timefy provides a robust toolkit to simplify time management tasks in Go applications.","archived":false,"fork":false,"pushed_at":"2024-12-11T04:36:01.000Z","size":53,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-26T19:02:06.489Z","etag":null,"topics":["go","go-time","go-time-format","golang","golang-library","golang-package","golang-time","time","time-format"],"latest_commit_sha":null,"homepage":"https://github.com/sivaosorg/timefy","language":"Go","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/sivaosorg.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-23T15:50:22.000Z","updated_at":"2024-12-11T04:36:05.000Z","dependencies_parsed_at":"2024-10-30T22:31:33.898Z","dependency_job_id":null,"html_url":"https://github.com/sivaosorg/timefy","commit_stats":null,"previous_names":["sivaosorg/timefy"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sivaosorg%2Ftimefy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sivaosorg%2Ftimefy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sivaosorg%2Ftimefy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sivaosorg%2Ftimefy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sivaosorg","download_url":"https://codeload.github.com/sivaosorg/timefy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247640467,"owners_count":20971558,"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":["go","go-time","go-time-format","golang","golang-library","golang-package","golang-time","time","time-format"],"created_at":"2024-10-26T19:13:23.209Z","updated_at":"2026-02-09T23:02:03.645Z","avatar_url":"https://github.com/sivaosorg.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# timefy\n\n**timefy** is a comprehensive Go library designed to enhance productivity by offering a wide range of time-related utilities. Whether you're dealing with date formatting, time zone conversions, or scheduling. Timefy provides a robust toolkit to simplify time management tasks in Go applications.\n\n### Requirements\n\n- Go version 1.23 or higher\n\n### Installation\n\nTo install, you can use the following commands based on your preference:\n\n- For a specific version:\n\n  ```bash\n  go get github.com/sivaosorg/timefy@v0.0.1\n  ```\n\n- For the latest version:\n  ```bash\n  go get -u github.com/sivaosorg/timefy@latest\n  ```\n\n### Getting started\n\n#### Getting timefy\n\nWith [Go's module support](https://go.dev/wiki/Modules#how-to-use-modules), `go [build|run|test]` automatically fetches the necessary dependencies when you add the import in your code:\n\n```go\nimport \"github.com/sivaosorg/timefy\"\n```\n\n#### Usage\n\n\u003e Calculating the time based on current time\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"time\"\n\n\t\"github.com/sivaosorg/timefy\"\n)\n\nfunc main() {\n\t// time based on current time\n\ttx := timefy.With(time.Now())        // 2024-10-25 21:31:00.690342\n\tfmt.Println(tx.BeginningOfMinute())  // 2024-10-25 21:31:00\n\tfmt.Println(tx.BeginningOfHour())    // 2024-10-25 21:00:00\n\tfmt.Println(tx.BeginningOfDay())     // 2024-10-25 00:00:00\n\tfmt.Println(tx.BeginningOfWeek())    // 2024-10-20 00:00:00\n\tfmt.Println(tx.BeginningOfMonth())   // 2024-10-01 00:00:00\n\tfmt.Println(tx.BeginningOfQuarter()) // 2024-10-01 00:00:00\n\tfmt.Println(tx.BeginningOfYear())    // 2024-01-01 00:00:00\n\tfmt.Println(tx.EndOfMinute())        // 2024-10-25 21:31:59.999999999 +0700 +07\n\tfmt.Println(tx.EndOfHour())          // 2024-10-25 21:59:59.999999999 +0700 +07\n\tfmt.Println(tx.EndOfDay())           // 2024-10-25 23:59:59.999999999 +0700 +07\n\tfmt.Println(tx.EndOfWeek())          // 2024-10-26 23:59:59.999999999 +0700 +07\n\tfmt.Println(tx.EndOfMonth())         // 2024-10-31 23:59:59.999999999 +0700 +07\n\tfmt.Println(tx.EndOfQuarter())       // 2024-12-31 23:59:59.999999999 +0700 +07\n\tfmt.Println(tx.EndOfYear())          // 2024-12-31 23:59:59.999999999 +0700 +07\n\ttx.WeekStartDay = time.Tuesday       // Default is Sunday\n\tfmt.Println(tx.EndOfWeek())          // 2024-10-28 23:59:59.999999999 +0700 +07\n}\n```\n\n\u003e Calculating the time based on another time\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"time\"\n\n\t\"github.com/sivaosorg/timefy\"\n)\n\nfunc main() {\n\t// time based on another time\n\tt := time.Date(2025, 01, 15, 17, 51, 49, 123456789, time.Local)\n\ttx := timefy.New(t)           // or timefy.With(t)\n\tfmt.Println(tx.EndOfMonth()) // 2025-01-31 23:59:59.999999999 +0700 +07\n}\n```\n\n\u003e Calculating the time based on configuration\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"time\"\n\n\t\"github.com/sivaosorg/timefy\"\n)\n\nfunc main() {\n\t// time based on configuration\n\tlocation, _ := time.LoadLocation(\"Asia/Ho_Chi_Minh\")\n\tconf := \u0026timefy.Config{\n\t\tWeekStartDay: time.Monday,\n\t\tTimeLocation: location,\n\t\tTimeFormats:  []string{\"2006-01-02 15:04:05\"},\n\t}\n\tt := time.Date(2025, 01, 15, 17, 51, 49, 123456789, time.Now().Location())\n\tfmt.Println(t)                              // 2025-01-15 17:51:49.123456789 +0700 +07\n\tfmt.Println(conf.With(t).BeginningOfWeek()) // 2025-01-13 00:00:00 +0700 +07\n\tv, _ := conf.Parse(\"2005-11-12 22:14:01\")\n\tfmt.Println(v) // 2005-11-12 22:14:01 +0700 +07\n}\n```\n\n\u003e Monday/ Sunday\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"time\"\n\n\t\"github.com/sivaosorg/timefy\"\n)\n\nfunc main() {\n\t// Monday / Sunday\n\tt := time.Date(2025, 01, 15, 17, 51, 49, 123456789, time.Now().Location())\n\tfmt.Println(timefy.Monday())                   // 2024-10-21 00:00:00 +0700 +07\n\tfmt.Println(timefy.Monday(\"15:35:34\"))         // 2024-10-21 15:35:34 +0700 +07\n\tfmt.Println(timefy.Sunday())                   // 2024-10-27 00:00:00 +0700 +07\n\tfmt.Println(timefy.Sunday(\"16:45:34\"))         // 2024-10-27 16:45:34 +0700 +07\n\tfmt.Println(timefy.EndOfSunday())              // 2024-10-27 23:59:59.999999999 +0700 +07\n\tfmt.Println(timefy.With(t).Monday())           // 2025-01-13 00:00:00 +0700 +07\n\tfmt.Println(timefy.With(t).Monday(\"15:35:34\")) // 2025-01-13 15:35:34 +0700 +07\n\tfmt.Println(timefy.With(t).Sunday())           // 2025-01-19 00:00:00 +0700 +07\n\tfmt.Println(timefy.With(t).Sunday(\"16:45:34\")) // 2025-01-19 16:45:34 +0700 +07\n\tfmt.Println(timefy.With(t).EndOfSunday())      // 2025-01-19 23:59:59.999999999 +0700 +07\n}\n```\n\n\u003e Parse String to Time\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/sivaosorg/timefy\"\n)\n\nfunc main() {\n\t// String to Time\n\tt, _ := timefy.Parse(\"2025\")\n\tfmt.Println(t) // 2025-01-01 00:00:00 +0700 +07\n\tt, _ = timefy.Parse(\"2025-02\")\n\tfmt.Println(t) // 2025-02-01 00:00:00 +0700 +07\n\tt, _ = timefy.Parse(\"2025-02-15\")\n\tfmt.Println(t) // 2025-02-15 00:00:00 +0700 +07\n\tt, _ = timefy.Parse(\"11-15\")\n\tfmt.Println(t) // 2024-11-15 00:00:00 +0700 +07\n\tt, _ = timefy.Parse(\"13:15\")\n\tfmt.Println(t) // 2024-10-25 13:15:00 +0700 +07\n\tt, _ = timefy.Parse(\"13:15:45\")\n\tfmt.Println(t) // 2024-10-25 13:15:45 +0700 +07\n\tt, _ = timefy.Parse(\"23\")\n\tfmt.Println(t) // 2024-10-25 23:00:00 +0700 +07\n\t// MustParse must parse string to time or it will panic\n\tt = timefy.MustParse(\"11\")\n\tfmt.Println(t) // 2024-10-25 11:00:00 +0700 +07\n\tt = timefy.MustParse(\"99:99\") // panic: can't parse string as time: 99:99\n\t// fmt.Println(t)\n\n\t// Extend timefy to support more formats is quite easy, just update timefy.TimeFormats with other time layouts, e.g:\n\ttimefy.TimeFormats = append(timefy.TimeFormats, \"02 Jan 2006 15:04\")\n\tfmt.Println(timefy.TimeFormats)\n}\n```\n\n### Contributing\n\nTo contribute to project, follow these steps:\n\n1. Clone the repository:\n\n   ```bash\n   git clone --depth 1 https://github.com/sivaosorg/timefy.git\n   ```\n\n2. Navigate to the project directory:\n\n   ```bash\n   cd timefy\n   ```\n\n3. Prepare the project environment:\n   ```bash\n   go mod tidy\n   ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsivaosorg%2Ftimefy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsivaosorg%2Ftimefy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsivaosorg%2Ftimefy/lists"}