abMatGit opened a new pull request, #3680:
URL: https://github.com/apache/avro/pull/3680
## What is the purpose of the change
This pull request partially addresses
[AVRO-2818](https://issues.apache.org/jira/browse/AVRO-2818) by adding support
for encoding ISO 8601 date strings (`YYYY-MM-DD`) in the Ruby SDK's `IntDate`
logical type.
Previously, `IntDate.encode` only accepted `Numeric` or `Date`/`Time`
objects. Passing a string such as `'1970-01-06'` would raise a `NoMethodError`
because `String#to_date` is not part of Ruby's standard library. This change
adds a `Date.parse` call when the input is a `String`, allowing callers to pass
ISO 8601 date strings directly without pre-converting them to `Date` objects.
## Verifying this change
This change added tests and can be verified as follows:
- Extended `test_int_date_conversion` in `test/test_logical_types.rb` to
assert that ISO 8601 date strings are correctly encoded to their integer day
offset from the Unix epoch
- `'1970-01-06'` encodes to `5`
- `'1970-01-01'` encodes to `0`
## Documentation
- Does this pull request introduce a new feature? yes
- If yes, how is the feature documented? not documented
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]