-
Notifications
You must be signed in to change notification settings - Fork 0
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
week of year berechnen #2
base: main
Are you sure you want to change the base?
Conversation
@@ -12,4 +12,32 @@ extension DateTimeExtension on DateTime { | |||
bool get isSameYear { | |||
return DateTime.now().year == year; | |||
} | |||
|
|||
int get weekOfYear { |
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.
Brauchen denke ich einen anderen Namen dafür. Wusste nicht direkt was damit gemeint ist
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.
weekOfTheYear oder andere vorschläge?
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.
.weekOfYear passt eigentlich, ist typisch z.B. in C#.
.week oder .day wäre noch schöner.
DateTime date = DateTime(year, month, day); | ||
|
||
// Berechne die differenz zum Beginn des Jahres | ||
int dayOfYear = date.difference(DateTime(year, 1, 1)).inDays + 1; |
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.
Würde zwei extensions hieraus machen.
.dayOfYear
.weekOfYear
Ein Test wäre hier zwingend für einen Merge.
Calculation of week number in a year.