From 1b78d84fb1d6138a86738d10eb35d3d748880e38 Mon Sep 17 00:00:00 2001 From: Lennart S <55597910+LennartCode@users.noreply.github.com> Date: Thu, 9 Apr 2026 18:39:33 +0200 Subject: [PATCH] Adding string parsing to Weekday. --- lib/src/tempo/weekday.dart | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/src/tempo/weekday.dart b/lib/src/tempo/weekday.dart index 52ffe55..eb45491 100644 --- a/lib/src/tempo/weekday.dart +++ b/lib/src/tempo/weekday.dart @@ -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. + factory Weekday.parse(String string) => + Weekday.values.skip(1).where((val) => val.name == string).single; }