Skip to content

week of year berechnen#2

Open
dasKamael wants to merge 2 commits intomainfrom
weekOfYear_DateTime_extenstion
Open

week of year berechnen#2
dasKamael wants to merge 2 commits intomainfrom
weekOfYear_DateTime_extenstion

Conversation

@dasKamael
Copy link
Copy Markdown

@dasKamael dasKamael commented Mar 13, 2024

Calculation of week number in a year.

return DateTime.now().year == year;
}

int get weekOfYear {
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.

Brauchen denke ich einen anderen Namen dafür. Wusste nicht direkt was damit gemeint ist

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

weekOfTheYear oder andere vorschläge?

Copy link
Copy Markdown
Member

@JPM84 JPM84 Mar 13, 2024

Choose a reason for hiding this comment

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

.weekOfYear passt eigentlich, ist typisch z.B. in C#.

.week oder .day wäre noch schöner.

Comment thread lib/extensions/date_time.extension.dart Outdated
DateTime date = DateTime(year, month, day);

// Berechne die differenz zum Beginn des Jahres
int dayOfYear = date.difference(DateTime(year, 1, 1)).inDays + 1;
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.

Würde zwei extensions hieraus machen.
.dayOfYear
.weekOfYear

Ein Test wäre hier zwingend für einen Merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants