Skip to content

[API Implementation]: Deconstruct for DateTime, DateTimeOffset, DateOnly, and TimeOnly - #79499

Merged
tarekgh merged 12 commits into
dotnet:mainfrom
deeprobin:issue-24601
Jan 15, 2023
Merged

tarekgh merged 12 commits into
dotnet:mainfrom
deeprobin:issue-24601

Conversation

@deeprobin

@deeprobin deeprobin commented Dec 10, 2022 •

Copy link
Copy Markdown
Contributor

Closes #24601

Current implementation

  • Proposal implementation
  • Reference implementation
  • Documentation
  • Tests

Proposed API

namespace System;

public readonly partial struct DateTime
{
    public DateTime(DateOnly date, TimeOnly time);
    public DateTime(DateOnly date, TimeOnly time, DateTimeKind kind);
    public void Deconstruct(out DateOnly date, out TimeOnly time);
    public void Deconstruct(out int year, out int month, out int day);
}

public readonly partial struct DateTimeOffset
{
    public DateTimeOffset(DateOnly date, TimeOnly time, TimeSpan offset);
    public void Deconstruct(out DateOnly date, out TimeOnly time, out TimeSpan offset);
}

public readonly partial struct DateOnly
{
    public void Deconstruct(out int year, out int month, out int day);
}

public readonly partial struct TimeOnly
{
    public void Deconstruct(out int hour, out int minute);
    public void Deconstruct(out int hour, out int minute, out int second);
    public void Deconstruct(out int hour, out int minute, out int second, out int millisecond);
    public void Deconstruct(out int hour, out int minute, out int second, out int millisecond, out int microsecond);
}

/cc @tarekgh

@ghost ghost added community-contribution Indicates that the PR has been added by a community member area-System.DateTime new-api-needs-documentation labels Dec 10, 2022
@ghost

ghost commented Dec 10, 2022

Copy link
Copy Markdown

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, to please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

@teo-tsirpanis
teo-tsirpanis requested a review from a team December 11, 2022 00:58
@deeprobin
deeprobin requested a review from tarekgh December 19, 2022 20:37
@deeprobin

Copy link
Copy Markdown
Contributor Author

I broke something... I think I saved something after rebuilding...
Give me 48 hours.

@build-analysis build-analysis Bot mentioned this pull request Dec 22, 2022
@tarekgh

tarekgh commented Jan 4, 2023

Copy link
Copy Markdown
Member

@deeprobin will you have a chance to address the remaining feedback comments? Thanks!

@tarekgh

tarekgh commented Jan 10, 2023

Copy link
Copy Markdown
Member

@deeprobin could you please address the remaining feedback to proceed with this?

@tarekgh

tarekgh commented Jan 10, 2023

Copy link
Copy Markdown
Member

/azp run runtime
/azp run dotnet-linker-tests
/azp run runtime-dev-innerloop

@azure-pipelines

Copy link
Copy Markdown
No pipelines are associated with this pull request.

@tarekgh

tarekgh commented Jan 10, 2023

Copy link
Copy Markdown
Member

/azp run runtime

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@tarekgh

tarekgh commented Jan 10, 2023

Copy link
Copy Markdown
Member

/azp run dotnet-linker-tests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@tarekgh

tarekgh commented Jan 10, 2023

Copy link
Copy Markdown
Member

/azp run runtime-dev-innerloop

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@tarekgh tarekgh closed this Jan 10, 2023
@tarekgh tarekgh reopened this Jan 10, 2023
@tarekgh

tarekgh commented Jan 11, 2023

Copy link
Copy Markdown
Member

@deeprobin could you please address the remaining comments to proceed with the merge? Also, please run the tests locally to save time if you see any failure before submitting it to the CI. Thanks!

@tarekgh

tarekgh commented Jan 12, 2023

Copy link
Copy Markdown
Member

@deeprobin could you please address the remaining comments?

@deeprobin
deeprobin requested a review from tarekgh January 13, 2023 21:15
@tarekgh

tarekgh commented Jan 13, 2023

Copy link
Copy Markdown
Member

@deeprobin thanks for updating the code. I have added a minor comment I hope you can fix before we proceed with merging the changes.

@tarekgh tarekgh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@deeprobin thanks a lot for your effort. LGTM.

@tarekgh

tarekgh commented Jan 15, 2023

Copy link
Copy Markdown
Member

The failure in the CI is unrelated and known.

@tarekgh
tarekgh merged commit ecc3a7b into dotnet:main Jan 15, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Feb 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-System.DateTime community-contribution Indicates that the PR has been added by a community member new-api-needs-documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deconstruct for DateTime, DateTimeOffset, DateOnly, and TimeOnly

2 participants