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

go-tupleconv: change the datetime conversion logic, improve tests #3

Merged
merged 3 commits into from
Aug 11, 2023

Conversation

askalt
Copy link
Contributor

@askalt askalt commented Aug 10, 2023

Datetime conversion logic changes:

  • Supported time layouts have been modified to be more strict.
  • Added parsing of time zone names for time formats without a numerical offset.

Other:

  • Added test to check conversion error with conversion list from MakeStringToTTConvFactory.
  • Added license.

@askalt askalt force-pushed the askalt/no-gh-save-timezone branch 2 times, most recently from ed5cf37 to 91bce95 Compare August 11, 2023 09:42
@askalt askalt changed the title go-tupleconv: change the timezone processing logic, improve tests go-tupleconv: change the datetime conversion logic, improve tests Aug 11, 2023
example_test.go Show resolved Hide resolved
@psergee
Copy link

psergee commented Aug 11, 2023

Pls, update changelog about changed date-time format and TZ support.

converter.go Outdated
ttTimeLayout = "2006-01-02T15:04:05.999999-0700"
dateTimeLayout = "2006-01-02 15:04:05"
dateOnlyLayout = "2006-01-02"
dateLayout = "2006-01-02"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Suggested change
dateLayout = "2006-01-02"
dateLayout = time.DateOnly

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reworked, now only two required formats are supported by default:

  • with numeric tz offset: 2006-01-02T15:04:05.999999999-0700
  • with tz name: 2006-01-02T15:04:05.999999999 Europe/Moscow

Copy link

@oleg-jukovec oleg-jukovec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the patch!

Copy link

@psergee psergee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the patch. lgtm

- Supported time layouts have been modified to be more strict.
- Added the ability to specify time zone name in datetime.
@askalt askalt merged commit afc0e97 into master Aug 11, 2023
4 checks passed
@askalt askalt deleted the askalt/no-gh-save-timezone branch August 11, 2023 17:08
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.

None yet

3 participants