Skip to content

Conversation

jftuga
Copy link

@jftuga jftuga commented Nov 23, 2024

Purpose

I have added the capability for the parsetime library to parse inputs in the following format:

2006-01-02 15:04:05 MST

Changes

This was done by adding the following code to the parseISO8601 function:

if len(group) == 10 && group[9] != "" {
	loc, err = toLocation(group[9])
	if err != nil {
		return t, priority, err
	}
}

The zone regular expression also needed to be updated. Are you in agreement with this change? All tests still pass (see below).

zone = `([a-zA-Z0-9+-]{3,6})?`  // Added parentheses to create a capturing group

I also fixed a misspelled word: February.

In order to add this feature, I needed to understand the code base. To that end, I asked claude.ai to generate comments for most of the functions. I then read over these comments and they seem accurate. I can remove these from the PR if you don't want them in there or just remove the Example usage sections of the comments.

Testing

I added two tests in parsetime_test.go to verify the new format. All tests passed when running go test. Can you please verify that these are good tests?

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

Successfully merging this pull request may close these issues.

1 participant