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

Date auto parsing from string is inconsistent #25777

Closed
2 tasks
shlomo-artlist opened this issue May 7, 2023 · 5 comments
Closed
2 tasks

Date auto parsing from string is inconsistent #25777

shlomo-artlist opened this issue May 7, 2023 · 5 comments
Assignees
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Search

Comments

@shlomo-artlist
Copy link

shlomo-artlist commented May 7, 2023

  • Package Name: @azure/search-documents
  • Package Version: 11.3.1
  • Operating system: Mac
  • nodejs
    • version: 16.15.0
  • typescript
    • version: 4.9

Describe the bug
It seems like results are getting back with mixed types in Date fields. Some are string while others are dates.
When looking into the difference I noticed that it will only parse ISO date strings that have all the 3 ms digits in them. If not, it would stay a string.
e.g.
'2023-03-30T07:13:57.397Z' - will parse
while:
'2023-03-30T07:13:57.39Z' - will not parse

Expected behavior
Parse always, or never.
Every valid ISO date should be parsed correctly.
NodeJS native function - Date - handles both cases.

@github-actions github-actions bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels May 7, 2023
@xirzec xirzec added bug This issue requires a change to an existing behavior in the product in order to be resolved. Client This issue points to a problem in the data-plane of the library. Search and removed question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels May 8, 2023
@github-actions github-actions bot removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label May 8, 2023
@xirzec
Copy link
Member

xirzec commented May 8, 2023

@dgetu looks like we need to adjust our date regex slightly: https://github.com/Azure/azure-sdk-for-js/blob/aca554effb8c77488693e25e409e28a4d5f3b35a/sdk/search/search-documents/src/serialization.ts#LL6C2-L6C2

I think we can just adjust the quantifier for ms like:

const ISO8601DateRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{1,3})?Z$/i;

@dgetu
Copy link
Member

dgetu commented May 8, 2023

That looks like it should do the trick. I'll validate this and try to squeeze this fix into this month's release.

@dgetu
Copy link
Member

dgetu commented May 9, 2023

This fix was merged and should be shipped in today's 11.3.2 and 12.0.0-beta.1 releases. Thanks for reporting this to us!

@dgetu dgetu closed this as completed May 9, 2023
@shlomo-artlist
Copy link
Author

Thanks for the fix!
Do you know when this 11.3.2 version going to be released?

@dgetu
Copy link
Member

dgetu commented May 17, 2023

Apologies for going back on what I said before -- 12.0.0-beta.1 was shipped last week, but when trying to ship 11.3.2, we ran into a delay with our release process. We're hoping to ship as soon as the end of this week, but you should be able to either apply this patch manually or temporarily use 12.0.0-beta.1 if you're in more urgent need of unblocking. The beta API surface is mostly just an extension of the stable surface, so it should be a drop-in replacement for most use cases.

@github-actions github-actions bot locked and limited conversation to collaborators Aug 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Search
Projects
None yet
Development

No branches or pull requests

3 participants