From d8805322d2f7dcecab0346f88215cbb525f7ea1d Mon Sep 17 00:00:00 2001 From: broodjeaap Date: Sat, 13 Jun 2020 14:27:52 +0200 Subject: [PATCH] Started work on a calculator 'lib' that the app is going to use --- lib/DayCalculator.dart | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 lib/DayCalculator.dart diff --git a/lib/DayCalculator.dart b/lib/DayCalculator.dart new file mode 100644 index 0000000..9be8f0a --- /dev/null +++ b/lib/DayCalculator.dart @@ -0,0 +1,10 @@ +// Based on this article: +// https://artofmemory.com/blog/how-to-calculate-the-day-of-the-week-4203.html + +class DayCalculator { + // Calculates (YY + floor(YY / 4)) % 7 + static int getYearValue(int year){ + var yy = year % 100; + return (yy + (yy / 4).floor()) % 7; + } +} \ No newline at end of file