Skip to content

Commit 69f12a3

Browse files
Merge pull request #1 from itlightning/prerelease/v0.1.0
Prepare v0.1.0 release
2 parents d5b3c60 + c943d3c commit 69f12a3

11 files changed

Lines changed: 49 additions & 24 deletions

File tree

.github/workflows/releaser.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Checkout
13-
uses: actions/checkout@v2
13+
uses: actions/checkout@v4
1414
with:
1515
fetch-depth: 0
1616
- name: Set up Go
17-
uses: actions/setup-go@v2
17+
uses: actions/setup-go@v4
1818
with:
19-
go-version: 1.19
19+
go-version: 1.20
2020
- name: Cache-Go
2121
uses: actions/cache@v1
2222
with:
@@ -30,7 +30,7 @@ jobs:
3030
- name: Test
3131
run: go test ./...
3232
- name: Run GoReleaser
33-
uses: goreleaser/goreleaser-action@v2
33+
uses: goreleaser/goreleaser-action@v5
3434
with:
3535
distribution: goreleaser
3636
version: latest

.github/workflows/test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ jobs:
44
test:
55
strategy:
66
matrix:
7-
go-version: [1.19.x]
7+
go-version: [1.20.x]
88
os: [ubuntu-latest]
99
runs-on: ${{ matrix.os }}
1010
steps:

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*.pprof
2+
*.test
3+
dist
4+
vendor

.goreleaser.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,19 @@ checksum:
1818
snapshot:
1919
name_template: "{{ .Tag }}-next"
2020
changelog:
21+
use: github-native
2122
sort: asc
2223
filters:
24+
include:
25+
- "^feat:"
2326
exclude:
2427
- '^docs:'
2528
- '^test:'
2629
nfpms:
2730
-
2831
vendor: dateparse
29-
homepage: https://github.com/araddon/dateparse
30-
maintainer: n/a <someone@eample.com>
32+
homepage: https://github.com/itlightning/dateparse
33+
maintainer: IT Lightning, LLC <opensource@itlightning.com>
3134
description: NA
3235
formats:
3336
- apk

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
language: go
22

33
go:
4-
- 1.13.x
4+
- 1.20.x
55

66
before_install:
77
- go get -t -v ./...

LICENSE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
The MIT License (MIT)
22

33
Copyright (c) 2015-2017 Aaron Raddon
4+
Copyright (c) 2023-2024 IT Lightning, LLC
45

56
Permission is hereby granted, free of charge, to any person obtaining a copy
67
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,29 @@
11
Go Date Parser
22
---------------------------
3+
[![GoDoc](https://godoc.org/github.com/itlightning/dateparse?status.svg)](http://godoc.org/github.com/itlightning/dateparse)
4+
![Test Status](https://github.com/itlightning/dateparse/actions/workflows/test.yaml/badge.svg)
5+
[![Go ReportCard](https://goreportcard.com/badge/itlightning/dateparse)](https://goreportcard.com/report/itlightning/dateparse)
36

4-
Parse many date strings without knowing format in advance. Validates comprehensively to avoid false positives. Uses a scanner to read bytes with a state machine to find format. Much faster than shotgun based parse methods. See [bench_test.go](https://github.com/araddon/dateparse/blob/master/bench_test.go) for performance comparison. See the critical note below about timezones.
7+
Parse date/time strings without knowing the format in advance. Supports 100+ formats. Validates comprehensively to avoid false positives. Very fast (~single-pass state-machine based approach). See [bench_test.go](https://github.com/itlightning/dateparse/blob/main/bench_test.go) for performance comparison. See the critical note below about timezones.
58

9+
⚡ Maintained by [IT Lightning](https://itlightning.com/), a cloud-first logging platform that's uniquely powerful, super-easy (schemaless, point-and-shoot ingestion), and affordable. It automatically extracts and classifies structured data out of your unstructured log messages. Enjoy visual pattern-analysis and robust SQL-like search. It's unique architecture means you can log more and pay less. Check it out and give us feedback! ⚡
610

7-
[![Code Coverage](https://codecov.io/gh/araddon/dateparse/branch/master/graph/badge.svg)](https://codecov.io/gh/araddon/dateparse)
8-
[![GoDoc](https://godoc.org/github.com/araddon/dateparse?status.svg)](http://godoc.org/github.com/araddon/dateparse)
9-
[![Build Status](https://travis-ci.org/araddon/dateparse.svg?branch=master)](https://travis-ci.org/araddon/dateparse)
10-
[![Go ReportCard](https://goreportcard.com/badge/araddon/dateparse)](https://goreportcard.com/report/araddon/dateparse)
11+
🐛💡 Find a bug or have an idea with this package? [Issues](https://github.com/itlightning/dateparse/issues) and pull requests are welcome.
1112

12-
**MM/DD/YYYY VS DD/MM/YYYY** Right now this uses mm/dd/yyyy WHEN ambiguous if this is not desired behavior, use `ParseStrict` which will fail on ambiguous date strings. This can be adjusted using the `PreferMonthFirst` parser option. Some ambiguous formats can fail (e.g., trying to parse 31/03/2023 as the default month-first format `MM/DD/YYYY`), but can be automatically retried with `RetryAmbiguousDateWithSwap`.
13+
14+
History and Contributors
15+
----------------------------------
16+
17+
This is an actively maintained fork of the excellent [original dateparse package](https://github.com/araddon/dateparse) by [@araddon](https://github.com/araddon).
18+
This fork [incorporates](https://github.com/araddon/dateparse/pull/159) many bugfixes from the community, and adds comprehensive validation and extensive performance optimizations.
19+
A special thanks to [@araddon](https://github.com/araddon), other contributors to the original project, as well as those who contributed fixes that got incorporated into this version:
20+
[@arran4](https://github.com/arran4), [@bizy01](https://github.com/bizy01), [@BrianLeishman](https://github.com/BrianLeishman), [@dferstay](https://github.com/dferstay), [@jiangxin](https://github.com/jiangxin), [@jmdacruz](https://github.com/jmdacruz), [@krhubert](https://github.com/krhubert), [@mehanizm](https://github.com/mehanizm), [@xwjdsh](https://github.com/xwjdsh), and [@zifengyu](https://github.com/zifengyu).
21+
22+
23+
Ambiguous Date Formats
24+
----------------------------------
25+
26+
**MM/DD/YYYY VS DD/MM/YYYY** Right now this uses mm/dd/yyyy *when* ambiguous. If this is not desired behavior, use `ParseStrict` which will fail on ambiguous date strings. This behavior can be adjusted using the `PreferMonthFirst` parser option. Some ambiguous formats can fail (e.g., trying to parse 31/03/2023 as the default month-first format `MM/DD/YYYY`), but can be automatically retried with `RetryAmbiguousDateWithSwap`.
1327

1428
```go
1529

@@ -21,14 +35,17 @@ t, err := dateparse.ParseStrict("3/1/2014")
2135
> returns error
2236

2337
// Return a string that represents the layout to parse the given date-time.
24-
// For certain highly complex date formats, ParseFormat may not be accurate,
25-
// even if ParseAny is able to correctly parse it (e.g., anything that starts
26-
// with a weekday).
38+
// For certain highly complex date formats, ParseFormat's return value may
39+
// not be accurate (if this is the case, the returned format string will be a
40+
// different length, than the input). In these cases, ParseAny will still be
41+
// able to successfully parse the format, but this return value will fail to
42+
// parse. For example, anything that starts with a full weekday will fail.
2743
layout, err := dateparse.ParseFormat("May 8, 2009 5:57:51 PM")
2844
> "Jan 2, 2006 3:04:05 PM"
2945

3046
```
3147

48+
3249
Performance Considerations
3350
----------------------------------
3451

@@ -42,7 +59,7 @@ option is off (default)).
4259
Timezone Considerations
4360
----------------------------------
4461

45-
**Timezones** The location your server is configured affects the results! See example or https://play.golang.org/p/IDHRalIyXh and last paragraph here https://golang.org/pkg/time/#Parse.
62+
The location that your server is configured to affects the results! See example or https://play.golang.org/p/IDHRalIyXh and last paragraph here https://golang.org/pkg/time/#Parse.
4663

4764
Important points to understand:
4865
* If you are parsing a date string that does *not* reference a timezone, if you use `Parse` it will assume UTC, or for `ParseIn` it will use the specified location.
@@ -56,13 +73,13 @@ Important points to understand:
5673
cli tool for testing dateformats
5774
----------------------------------
5875

59-
[Date Parse CLI](https://github.com/araddon/dateparse/blob/master/dateparse)
76+
[Date Parse CLI](https://github.com/itlightning/dateparse/tree/main/dateparse)
6077

6178

6279
Extended example
6380
-------------------
6481

65-
https://github.com/araddon/dateparse/blob/master/example/main.go
82+
https://github.com/itlightning/dateparse/blob/main/example/main.go
6683

6784
```go
6885
package main

dateparse/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Simple CLI to test out dateparse.
66

77
```sh
88

9-
# Since this date string has no timezone/offset so is more effected by
9+
# Since this date string has no timezone/offset it's more affected by
1010
# which method you use to parse
1111

1212
$ dateparse --timezone="America/Denver" "2017-07-19 03:21:00"

dateparse/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"os"
77
"time"
88

9-
"github.com/araddon/dateparse"
9+
"github.com/itlightning/dateparse"
1010
"github.com/scylladb/termtables"
1111
)
1212

example/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"fmt"
66
"time"
77

8-
"github.com/araddon/dateparse"
8+
"github.com/itlightning/dateparse"
99
"github.com/scylladb/termtables"
1010
)
1111

0 commit comments

Comments
 (0)