-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[Service Bus] Convert ISO-8601 timestamp string into Date type #9434
Changes from 4 commits
6e61ce7
502d156
85d9e14
0f2a1cf
ceb8a36
cd7c057
6f14676
0f852b0
b18fdc6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -242,6 +242,21 @@ export function getIntegerOrUndefined(value: any): number | undefined { | |
return result == NaN ? undefined : result; | ||
} | ||
|
||
/** | ||
* @internal | ||
* @ignore | ||
* Helper utility to convert ISO-8601 time into Date type, | ||
* or undefined for invalid values. | ||
* @param value | ||
*/ | ||
export function getDateOrUndefined(value: string): Date | undefined { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When does this happen, btw? Like if a queue is newly created? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for asking, I had a vague recollection from the last week of testing that the value could be undefined, however after some more testing today, it seems the service always returns a valid timestamp. I'll update this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated! |
||
try { | ||
return new Date(value); | ||
} catch (error) { | ||
return undefined; | ||
} | ||
} | ||
|
||
/** | ||
* @internal | ||
* @ignore | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did a little tour of the SDK (not just SB) code base and I see 'At' and 'On'. Is this the official proper suffix now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.NET was doing "At". This is to be consistent with that since there seems no reason to deviate.
Both "At" and "On" seem fine to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a guideline to use one or the other, can we check that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't find that in the guidelines.
But I found an unrelated example which has "lastModifiedDate".
https://azure.github.io/azure-sdk/general_design.html#model-types
Moreover, Storage SDKs are following "On".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not convinced with changing from
on
toat
I recall during Event Hubs work that we consistently changed all such properties to use
on
across all languages. I would recommend we revert the name change and keep the type change in this PR. We can revisit the name laterThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll revert.