feat: Convert all app files to JS

This commit is contained in:
Faruk AYDIN
2024-01-05 17:44:21 +01:00
parent b95478b635
commit 43dba351c3
1030 changed files with 5114 additions and 6436 deletions

View File

@@ -0,0 +1,10 @@
const cronTimes = {
everyHour: '0 * * * *',
everyHourExcludingWeekends: '0 * * * 1-5',
everyDayAt: (hour) => `0 ${hour} * * *`,
everyDayExcludingWeekendsAt: (hour) => `0 ${hour} * * 1-5`,
everyWeekOnAndAt: (weekday, hour) => `0 ${hour} * * ${weekday}`,
everyMonthOnAndAt: (day, hour) => `0 ${hour} ${day} * *`,
};
export default cronTimes;

View File

@@ -1,11 +0,0 @@
const cronTimes = {
everyHour: '0 * * * *',
everyHourExcludingWeekends: '0 * * * 1-5',
everyDayAt: (hour: number) => `0 ${hour} * * *`,
everyDayExcludingWeekendsAt: (hour: number) => `0 ${hour} * * 1-5`,
everyWeekOnAndAt: (weekday: number, hour: number) =>
`0 ${hour} * * ${weekday}`,
everyMonthOnAndAt: (day: number, hour: number) => `0 ${hour} ${day} * *`,
};
export default cronTimes;

View File

@@ -1,7 +1,6 @@
import { DateTime } from 'luxon';
import { IJSONObject } from '@automatisch/types';
export default function getDateTimeObjectRepresentation(dateTime: DateTime) {
export default function getDateTimeObjectRepresentation(dateTime) {
const defaults = dateTime.toObject();
return {
@@ -11,5 +10,5 @@ export default function getDateTimeObjectRepresentation(dateTime: DateTime) {
pretty_time: dateTime.toLocaleString(DateTime.TIME_WITH_SECONDS),
pretty_day_of_week: dateTime.toFormat('cccc'),
day_of_week: dateTime.weekday,
} as IJSONObject;
};
}

View File

@@ -1,7 +1,7 @@
import { DateTime } from 'luxon';
import cronParser from 'cron-parser';
export default function getNextCronDateTime(cronString: string) {
export default function getNextCronDateTime(cronString) {
const cronDate = cronParser.parseExpression(cronString);
const matchingNextCronDateTime = cronDate.next();
const matchingNextDateTime = DateTime.fromJSDate(