A Go library that parses date strings without requiring prior knowledge of their format.
Dateparse is a Go library that intelligently parses date and time strings without requiring the format to be specified beforehand. It solves the problem of handling diverse date formats in data processing, log parsing, or user input by automatically detecting the format using a state machine. This eliminates the need for multiple parsing attempts or complex format-matching logic.
Go developers working with heterogeneous date sources, such as log files, CSV data, APIs, or user-generated content where date formats are inconsistent or unknown.
Developers choose Dateparse for its performance and convenience—it's faster than trial-and-error parsing and reduces boilerplate code. Its strict mode and layout detection provide flexibility and control, making it a robust alternative to Go's standard time.Parse.
GoLang Parse many date strings without knowing format in advance.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Parses numerous date-time formats including RFC, ISO, Unix timestamps, and localized variations, as demonstrated by the extensive list of over 70 examples in the README.
Uses a state machine and scanner approach, making it significantly faster than brute-force parsing methods, with benchmarks provided in bench_test.go.
Offers ParseStrict to error on ambiguous dates like mm/dd vs dd/mm, giving developers the ability to enforce unambiguous parsing when needed, as highlighted in the README warnings.
Includes ParseFormat to return the Go layout string for a given date, useful for debugging or transforming dates into specific formats, shown in the code example.
Defaults to mm/dd/yyyy for ambiguous dates, which may not align with regional preferences, and strict mode simply fails without offering alternative parsing strategies, as admitted in the README.
Parsing results are affected by the server's configured timezone, as noted in the README, which can lead to unexpected behavior if not properly managed, requiring extra configuration like ParseLocal.
While comprehensive, the library may not support every possible date format, especially non-standard or evolving formats, relying on updates to the internal scanner and state machine.