aboutsummaryrefslogtreecommitdiff
path: root/Functions/dateFuncs.js
diff options
context:
space:
mode:
Diffstat (limited to 'Functions/dateFuncs.js')
-rw-r--r--Functions/dateFuncs.js21
1 files changed, 20 insertions, 1 deletions
diff --git a/Functions/dateFuncs.js b/Functions/dateFuncs.js
index 10c4250..9b1237a 100644
--- a/Functions/dateFuncs.js
+++ b/Functions/dateFuncs.js
@@ -17,7 +17,26 @@ function approxDate(d)
return new Date(`${d.getFullYear()}-${(d.getMonth() + 1).toString().padStart(2, "0")}-${d.getDate().toString().padStart(2, "0")}`);
}
+function weekdayToNumber(s)
+{
+ const weekdays = [
+ /ma.*/i,
+ /ti.*/i,
+ /ke.*/i,
+ /to.*/i,
+ /pe.*/i,
+ /la.*/i,
+ /su.*/i
+ ];
+ for(let day = 0; day < weekdays.length; day++)
+ {
+ if (s.match(weekdays[day]))
+ return day;
+ }
+}
+
module.exports = {
fromString: stringToDate,
- between: isBetweenDates
+ between: isBetweenDates,
+ weekdayToNumber: weekdayToNumber
} \ No newline at end of file