{"id":18023723,"url":"https://github.com/bsolomon1124/isoparse","last_synced_at":"2025-07-05T06:04:10.053Z","repository":{"id":66110232,"uuid":"150614689","full_name":"bsolomon1124/isoparse","owner":"bsolomon1124","description":"Parse ISO-8601 datetimes (Go port of Python's dateutil)","archived":false,"fork":false,"pushed_at":"2018-09-27T16:19:46.000Z","size":17,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-10T03:41:53.922Z","etag":null,"topics":["datetimes","golang"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bsolomon1124.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":"2018-09-27T16:13:27.000Z","updated_at":"2021-03-16T16:45:49.000Z","dependencies_parsed_at":"2023-02-23T18:16:22.306Z","dependency_job_id":null,"html_url":"https://github.com/bsolomon1124/isoparse","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/bsolomon1124%2Fisoparse","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsolomon1124%2Fisoparse/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsolomon1124%2Fisoparse/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsolomon1124%2Fisoparse/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bsolomon1124","download_url":"https://codeload.github.com/bsolomon1124/isoparse/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247227626,"owners_count":20904734,"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":["datetimes","golang"],"created_at":"2024-10-30T07:10:29.077Z","updated_at":"2025-04-04T18:25:51.987Z","avatar_url":"https://github.com/bsolomon1124.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# isoparse\n\nPackage isoparse parses strings representing ISO-8601-conformant datetimes,\ndates, and times into instances of Go's `time.Time`.\n\nMost of its parsing logic is ported directly from the isoparser module,\nauthored by Paul Ganssle, within Python's dateutil library.\n\nUnlike the parser in Go's time package, isoparse's functions do not require\nthe precise format to be specified in advance.\n\nIt does not make every attempt to mirror Python's dateutil exactly,\npartially because of differences in behavior between Python and Go.\n\nThe isoparse package exports three parsing functions:\n\n- `ParseISODatetime`: parses a datetime (combined date and time string). Note that this function can also parse just a date in isolation, but if the user knows that input strings contain only dates with no time components, it will be faster to use ParseISODate.\n- `ParseISODate`: parses a date string with no time component.\n- `ParseISOTime`: parses a time string with no date component. This does not return a time.Time instance, but rather the hour/minute/second/nsec components and the location.\n\n## A Note On Time Zone Handling\n\nPython's datetime has a concept of a naive datetime:\n\n\u003e A naive object does not contain enough information to unambiguously locate itself relative to other date/time objects.\n\nThis is useful in situations where, given a datetime string such as\n\"2018-09-27T11:52:59\", it is left up to the user to determine which time\nzone should added as an attribute, if any at all. Contrarily, Go's\ntime.Date, which produces a time.Time instance, has a required location\nparameter whose nil value is UTC, and is an unexported struct field that\ncannot be changed independently of changing the timestamp itself.\n\nFor that reason:\n\n- All datetimes and times that lack a visible offset will have `time.Local` attached to them. This represents a \"best assumption\" that the datetime string is from the package user's local time zone.\n- This package also exports a simple function `SetLoc` that produces a new `time.Time` given a different time zone but the same timestamp components.  This is different from Go's `time.Time.In`, `time.Time.UTC`, or `time.Time.Local` in that these conversions may change attributes such as `t.Hour` in the resulting timestamp itself.\n\nNote also that input strings that do contain a recognizable UTC offset will\nbe given a loc that is the result of time.FixedZone, with the generic name\nof \"UTC\" and a specified seconds-east offset from UTC. There is no attempt\nto determine an IANA time zone by name because, for instance, an offset of\n-05:00 is still ambiguous based on whether daylight savings time is in\neffect or not.\n\nBecause `time.Time.String` uses:\n\n```go\nfunc (t Time) String() string {\n\ts := t.Format(\"2006-01-02 15:04:05.999999999 -0700 MST\")\n\t...\n}\n```\n\nThe `time.Time` resulting from isoparse's parsing functions will have a loc that\nlooks like `time.FixedZone(\"UTC\", secondsEast)` and will be printed as:\n\n    YYYY-MM-DD HH:MM:SS.sssssssss -HHMM UTC\n\nIf you want more control over the actual resulting format, use\n`time.Time.Format` on the result.\n\n## Conformance And Nonconformance To ISO-8601\n\nisoparse conforms mostly to the [December 2004 ISO Standard 8601](https://www.iso.org/standard/40874.html), which\ncancels and replaces the second edition (ISO 8601:2000) with minor\nrevisions.\n\nFor a (non-exhaustive) list of supported formats, execute the example\nfunction ExampleParseISODatetime from example_test.go to see a range of\nsupported format examples.\n\nThe following is a list of ways in which this the exported functions in this\npackage deviates from the ISO-8601:2004 standard:\n\n- The standard is strict about \"T\" being the separator between date and time. This package allows any ASCII character except 0 thru 9 as the separator between date and time, rather than just \"T\".\n- The standard allows years less than 0 and greater than 9999. This package only permits years greater than 0 and less than 10,000.\n- This package does not support parsing time intervals or recurring time intervals as defined in sections 4.4 and 4.5 of the standard, respectively.\n- The standard technically allows \"19\" to represent the date 1900-01-01, or \"23\" to represent the time 23:00:00, as \"representation[s] with reduced accuracy.\" This package does not allow these formats.  (Although YYYY-MM and YYYY are valid here.)\n- Unless otherwise note, this package does not support \"expanded representations\" for dates (sections 4.1.2.4, 4.1.3.3, 4.1.4.4).\n- Representations that \"are only allowed by mutual agreement of the partners in information exchange\" are generally not valid under this package.\n- Support for fractional components other than seconds is part of the ISO-8601 standard, but is not currently implemented in this parser.  (This follows Python's dateutil.) For instance (from Wikipedia): \"To denote '14 hours, 30 and one half minutes,' do not include a seconds figure. Represent it as '14:30,5', '1430,5', '14:30.5', or '1430.5'.\"  These 4 datetime strings will return a ParseError from ParseISODatetime.\n\n\n## Other Notes\n\nIn addition to following closely with dateutil's isoparser module, this\npackage also ports code from Python's native datetime module and Go's time\npackage.\n\n## Exported Objects\n\n```\nfunc ParseISODate(dateString string) (time.Time, error)\nfunc ParseISODatetime(datetime string) (time.Time, error)\nfunc ParseISOTime(timeString string) (components [4]int, tz *time.Location, err error)\nfunc SetLoc(t time.Time, loc *time.Location) time.Time\ntype ParseError struct{ ... }\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbsolomon1124%2Fisoparse","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbsolomon1124%2Fisoparse","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbsolomon1124%2Fisoparse/lists"}