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

Improvement: Extensions methods for DateTime and DateTimeOffset to DateTimeTimeZone #366

Closed
1 of 4 tasks
baywet opened this issue Jan 24, 2019 · 2 comments · Fixed by #555
Closed
1 of 4 tasks

Improvement: Extensions methods for DateTime and DateTimeOffset to DateTimeTimeZone #366

baywet opened this issue Jan 24, 2019 · 2 comments · Fixed by #555

Comments

@baywet
Copy link
Member

baywet commented Jan 24, 2019

Please provide the following (and please check them off the list with [x]) before submitting this issue:

  • Expected behavior. Please provide links to the specific Microsoft Graph documentation you used to determine the expected behavior.
  • Actual behavior. Provide error codes, stack information, and a Fiddler capture of the request and response (please remove personally identifiable information before posting).
  • Steps to reproduce the behavior. Include your code, IDE versions, client library versions, and any other information that might be helpful to understand your scenario.
  • Improvement suggestion, no reproduction provided

Expected behavior

The DateTimeTimeZone entity is widely used accross the Graph and reflected in the dotnet SDK.
However it's properties are pure strings which allows for little validation and requires the consumer to do the serialization of these properties.
It'd be very interesting to have two extension methods to make people's lives simpler (and less prone to errors)

public static ToDateTimeTimeZone(this DateTime dateTime, TimeZone timezone): DateTimeTimeZone;
public static ToDateTimeTimeZone(this DateTimeOffset dateTimeOffset):DateTimeTimeZone;
@peombwa
Copy link
Member

peombwa commented Jan 25, 2019

@baywet Thanks for suggesting this improvement. We have added this to our backlog and we will enable it soon.

#952289

@michael-hawker
Copy link
Contributor

It'd also be nice to have things go the other way where a DateTimeTimeZone object can become a DateTimeOffset value. This makes it easier to format the result with ToString formatters.

public static DateTimeOffset ToDateTimeOffset(this DateTimeTimeZone dateTimeTimeZone);

MIchaelMainer pushed a commit that referenced this issue Oct 15, 2019
* upgraded unit tests project to dotnetcore 2.2 and upgraded minor dependencies
* code linting
* fixes #366, datetimetimezone added new extensions methods
* upgraded appveyor image to vs 2019 to fix ci
* removed deprecated project property
@ghost ghost locked as resolved and limited conversation to collaborators Feb 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants