aboutsummaryrefslogtreecommitdiff
path: root/test.nim
diff options
context:
space:
mode:
authorhistoria <gravel.justness270@slmail.me>2024-07-30 00:26:29 -0400
committerhistoria <gravel.justness270@slmail.me>2024-07-30 00:26:29 -0400
commit43d1d1ef9b75e694f1b3e49ceaf319d87f6b14a9 (patch)
tree9a6bf1474ae77363f115f32b2a4ce2b475c6b728 /test.nim
parent2438fe0116bb4c8abafb4e236c148ba0f8290e6a (diff)
downloadsoon-43d1d1ef9b75e694f1b3e49ceaf319d87f6b14a9.tar.gz
Removed ! from Julian dates. Minor work on logic.
Diffstat (limited to 'test.nim')
-rw-r--r--test.nim12
1 files changed, 12 insertions, 0 deletions
diff --git a/test.nim b/test.nim
new file mode 100644
index 0000000..7333396
--- /dev/null
+++ b/test.nim
@@ -0,0 +1,12 @@
+import std/[times, os, strutils, strbasics, strscans, sets, re, tables], parseopt
+
+proc getWeekNumber(date: DateTime): int =
+ return int((date.monthDay - 1) / 7) + 1
+
+proc getWeekNumberFromEnd(date: DateTime): int =
+ let daysInMonth = getDaysInMonth(date.month, date.year)
+ let day = date.monthday
+ return int((daysInMonth - day) / 7) + 1
+
+var d = now() - 21.days
+echo getWeekNumber(d)