Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/src/tempo/weekday.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,10 @@ enum Weekday {
///
/// US weekdays are numbered 0=Sunday to 6=Saturday.
int get us => index % 7;

/// Parses a string to a weekday.
///
/// Takes a lower-case weekday name in English and returns the respective enumerated value.
Comment on lines +29 to +31
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Lets focus more on the idea that this is the inverse of the name field. The fact that it's english isn't all that important. Something like "Parses the output of [name]." You could probably get away with just that single line and no other explanation.

factory Weekday.parse(String string) =>
Weekday.values.skip(1).where((val) => val.name == string).single;
}
Loading