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

[API Proposal]: DateOnly support in IsoWeek #101597

Open
leonluc-dev opened this issue Apr 26, 2024 · 1 comment
Open

[API Proposal]: DateOnly support in IsoWeek #101597

leonluc-dev opened this issue Apr 26, 2024 · 1 comment
Labels
api-ready-for-review API is ready for review, it is NOT ready for implementation area-System.Globalization
Milestone

Comments

@leonluc-dev
Copy link

leonluc-dev commented Apr 26, 2024

Background and motivation

At the moment the IsoWeek class only supports DateTime structs.

Since the IsoWeek class is primarily (if not exclusively) based around dates rather than times, it would make sense to have it support the recently added DateOnly struct.

API Proposal

Adding DateOnly variants of the public methods on the IsoWeek class.

namespace System.Globalization
{
    public static class ISOWeek
    {
        //Added methods
        public static int GetWeekOfYear(DateOnly date);
        public static int GetYear(DateOnly date);
        public static DateOnly ToDateOnly(int year, int week, DayOfWeek dayOfWeek);
    }
}

API Usage

var week = IsoWeek.GetWeekOfYear(new DateOnly(2024, 4, 26));

Alternative Designs

No response

Risks

No response

@leonluc-dev leonluc-dev added the api-suggestion Early API idea and discussion, it is NOT ready for implementation label Apr 26, 2024
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Apr 26, 2024
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-globalization
See info in area-owners.md if you want to be subscribed.

@tarekgh tarekgh added this to the Future milestone Apr 26, 2024
@tarekgh tarekgh added api-ready-for-review API is ready for review, it is NOT ready for implementation and removed untriaged New issue has not been triaged by the area owner api-suggestion Early API idea and discussion, it is NOT ready for implementation labels Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-ready-for-review API is ready for review, it is NOT ready for implementation area-System.Globalization
Projects
None yet
Development

No branches or pull requests

2 participants