Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parses string as a date #160

Open
shivamsouravjha opened this issue Apr 2, 2024 · 1 comment
Open

parses string as a date #160

shivamsouravjha opened this issue Apr 2, 2024 · 1 comment

Comments

@shivamsouravjha
Copy link

import (
	"fmt"
	"strings"

	"github.com/araddon/dateparse"
)

func main() {
	stringDate := "music, coding, artd"
	s := strings.TrimSpace(stringDate)
	date, err := dateparse.ParseAny(s)
	fmt.Println(date, err)
}
@klondikedragon
Copy link

@shivamsouravjha - validation was added in the forked package https://pkg.go.dev/github.com/itlightning/dateparse -- your example should properly fail to parse "music, coding, artd" in the updated package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants