Author SHA1 Message Date
klemek 9b6d43253e chore: 1.7.0
Python Lint CI / ty (push) Successful in 4m49s
Python Lint CI / ruff-format-check (push) Successful in 5m7s
TS Lint / ESLint (push) Successful in 5m34s
TS Lint / Oxlint (push) Successful in 11m18s
TS Lint / TypeScript (push) Successful in 12m41s
Docker Build / build (push) Successful in 18m43s
Python Lint CI / ruff (push) Successful in 4m50s
2026-07-29 14:41:18 +02:00
klemek 321892bfac feat: add rrule start date
TS Lint / Oxlint (push) Has been cancelled
TS Lint / TypeScript (push) Has been cancelled
TS Lint / ESLint (push) Has been cancelled
Docker Build / build (push) Has been cancelled
2026-07-29 14:41:06 +02:00
klemek 7daa0802cc chore: 1.6.2
Docker Build / build (push) Successful in 8m12s
TS Lint / ESLint (push) Successful in 3m51s
TS Lint / Oxlint (push) Successful in 4m53s
TS Lint / TypeScript (push) Successful in 5m7s
Python Lint CI / ruff (push) Successful in 4m25s
Python Lint CI / ty (push) Successful in 3m58s
Python Lint CI / ruff-format-check (push) Successful in 4m0s
2026-07-29 09:45:37 +02:00
klemek 84c6359583 fix: responsive
Docker Build / build (push) Has been cancelled
TS Lint / ESLint (push) Has been cancelled
TS Lint / Oxlint (push) Has been cancelled
TS Lint / TypeScript (push) Has been cancelled
2026-07-29 09:45:20 +02:00
9 changed files with 62 additions and 18 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "tout-doux",
"version": "1.6.1",
"version": "1.7.0",
"private": true,
"type": "module",
"engines": {
+1 -1
View File
@@ -1,6 +1,6 @@
[project]
name = "tout-doux"
version = "1.6.1"
version = "1.7.0"
description = ""
requires-python = ">=3.14"
dependencies = [
+2 -1
View File
@@ -44,7 +44,8 @@
"October",
"November",
"December"
]
],
"rrule_start": "Start:"
},
"checked": "Checked",
"resets": "Resets",
+2 -1
View File
@@ -44,7 +44,8 @@
"Octobre",
"Novembre",
"Décembre"
]
],
"rrule_start": "Début :"
},
"checked": "Complété",
"resets": "Reviens",
+1 -1
View File
@@ -25,7 +25,7 @@ onMounted(() => {
<div class="hero bg-hero grow">
<div class="hero-content text-center p-0">
<div
class="max-w-96 bg-base-100 rounded-box shadow-md p-4"
class="max-w-96 min-w-screen sm:min-w-96 bg-base-100 rounded-box shadow-md p-4"
>
<router-link
to="/"
+20 -2
View File
@@ -12,16 +12,18 @@ const props = defineProps<{ editMode: boolean }>();
const cronType = ref<CronType>(CronType.MANUAL);
const cronValue = ref<string>('0');
const cronDate = ref<Date>(new Date());
function onCronChanged() {
const data = parseCron(cron.value);
rawCron.value = cron.value ?? DEFAULT_CRON;
cronType.value = data.type;
cronValue.value = data.value.toFixed(0);
cronDate.value = data.date ?? new Date();
}
function updateCron() {
cron.value = getCron(cronType.value, parseInt(cronValue.value), rawCron.value);
cron.value = getCron(cronType.value, parseInt(cronValue.value), cronDate.value, rawCron.value);
}
function onChangeCronType() {
@@ -48,6 +50,11 @@ function onChangeCronValue() {
updateCron();
}
function onChangeCronDate(event: InputEvent) {
cronDate.value = new Date((event.target as HTMLInputElement).value);
updateCron();
}
function onInputRawCron() {
valid.value = validCron(rawCron.value);
if (valid.value) {
@@ -65,7 +72,7 @@ watch(cron, () => {
</script>
<template>
<div class="flex gap-2">
<div class="flex gap-2 flex-wrap">
<select v-model="cronType" class="select flex-1" @change="onChangeCronType">
<option :value="CronType.MANUAL">
{{ $t("cron.type.manual") }}
@@ -195,5 +202,16 @@ watch(cron, () => {
class="input font-mono flex-1"
@input="onChangeCronValue"
/>
<label class="label flex-1 basis-full">
{{ $t("cron.rrule_start") }}
<input
v-if="cronType === CronType.EVERY_N_DAYS || cronType === CronType.EVERY_N_WEEKS || cronType === CronType.EVERY_N_MONTHS"
:value="cronDate.toISOString().substring(0, 10)"
required
type="date"
class="input font-mono"
@input="onChangeCronDate"
/>
</label>
</div>
</template>
+28 -7
View File
@@ -7,17 +7,20 @@ const ONE_TIME_VALUE = "@one-time";
export function parseCron(cron: string | null): {
type: CronType;
value: number;
date: Date|null;
} {
let value: RegExpMatchArray | null;
if (cron === null) {
return {
type: CronType.MANUAL,
value: 0,
date: null,
};
} else if (cron === ONE_TIME_VALUE) {
return {
type: CronType.ONE_TIME,
value: 0,
date: null,
};
} else if (cron.startsWith("RRULE:")) {
return parseRrule(cron);
@@ -25,41 +28,49 @@ export function parseCron(cron: string | null): {
return {
type: CronType.EVERY_DAY,
value: parseInt(value[1] ?? ""),
date: null,
};
} else if ((value = /^0 0 \* \* (\d+)$/i.exec(cron)) !== null) {
return {
type: CronType.EVERY_WEEK,
value: parseInt(value[1] ?? ""),
date: null,
};
} else if ((value = /^0 0 (\d+) \* \*$/i.exec(cron)) !== null) {
return {
type: CronType.EVERY_MONTH,
value: parseInt(value[1] ?? ""),
date: null,
};
} else if ((value = /^0 0 L \* \*$/i.exec(cron)) !== null) {
return {
type: CronType.EVERY_MONTH,
value: 32,
date: null,
};
} else if ((value = /^0 0 \* \* (\d+)#1$/i.exec(cron)) !== null) {
return {
type: CronType.EVERY_MONTH,
value: -parseInt(value[1] ?? ""),
date: null,
};
} else if ((value = /^0 0 \* \* (\d+)L$/i.exec(cron)) !== null) {
return {
type: CronType.EVERY_MONTH,
value: -parseInt(value[1] ?? "") - 7,
date: null,
};
} else if ((value = /^0 0 1 (\d+) \*$/i.exec(cron)) !== null) {
return {
type: CronType.EVERY_YEAR,
value: parseInt(value[1] ?? ""),
date: null,
};
} else {
return {
type: CronType.CUSTOM,
value: 0,
date: null,
};
}
}
@@ -67,6 +78,7 @@ export function parseCron(cron: string | null): {
export function parseRrule(rule: string): {
type: CronType;
value: number;
date: Date | null;
} {
try {
const rrule = RRule.parseString(rule);
@@ -75,21 +87,25 @@ export function parseRrule(rule: string): {
return {
type: CronType.EVERY_N_MONTHS,
value: (rrule.interval ?? 1) * 12,
date: rrule.dtstart ?? null,
};
case RRule.MONTHLY:
return {
type: CronType.EVERY_N_MONTHS,
value: rrule.interval ?? 1,
date: rrule.dtstart ?? null,
};
case RRule.WEEKLY:
return {
type: CronType.EVERY_N_WEEKS,
value: rrule.interval ?? 1,
date: rrule.dtstart ?? null,
};
case RRule.DAILY:
return {
type: CronType.EVERY_N_DAYS,
value: rrule.interval ?? 1,
date: rrule.dtstart ?? null,
};
}
} catch {
@@ -98,12 +114,14 @@ export function parseRrule(rule: string): {
return {
type: CronType.MANUAL,
value: 0,
date: null,
};
}
export function getCron(
type: CronType,
value: number,
date: Date,
fallback: string,
): string | null {
switch (type) {
@@ -127,11 +145,11 @@ export function getCron(
case CronType.EVERY_YEAR:
return `0 0 1 ${value.toFixed(0)} *`;
case CronType.EVERY_N_MONTHS:
return `RRULE:FREQ=MONTHLY;INTERVAL=${value.toFixed(0)}`;
return `RRULE:FREQ=MONTHLY;INTERVAL=${value.toFixed(0)}\nDTSTART:${dtStartFormat(date)}`;
case CronType.EVERY_N_WEEKS:
return `RRULE:FREQ=WEEKLY;INTERVAL=${value.toFixed(0)}`;
return `RRULE:FREQ=WEEKLY;INTERVAL=${value.toFixed(0)}\nDTSTART:${dtStartFormat(date)}`;
case CronType.EVERY_N_DAYS:
return `RRULE:FREQ=DAILY;INTERVAL=${value.toFixed(0)}`;
return `RRULE:FREQ=DAILY;INTERVAL=${value.toFixed(0)}\nDTSTART:${dtStartFormat(date)}`;
case CronType.CUSTOM:
if (validCron(fallback)) {
return fallback;
@@ -141,6 +159,10 @@ export function getCron(
return null;
}
function dtStartFormat(date: Date): string {
return `${date.getFullYear().toFixed(0)}${(date.getMonth() + 1).toFixed(0).padStart(2, '0')}${date.getDate().toFixed(0).padStart(2, '0')}T000000Z`
}
export function isOneTime(cron: string | null): boolean {
return cron === ONE_TIME_VALUE;
}
@@ -155,11 +177,11 @@ export function validCron(cron: string): boolean {
}
export function nextCronReset(
date: Date | null,
date: Date,
cron: string | null,
hash: string,
): Date | null {
if (date === null || cron === null || isOneTime(cron)) {
if (cron === null || isOneTime(cron)) {
return null;
}
try {
@@ -167,11 +189,10 @@ export function nextCronReset(
try {
const rule = new RRule({
...RRule.parseString(cron),
dtstart: date,
count: 2,
});
return rule.all()[1] ?? null;
return rule.after(date) ?? null;
} catch {
// ignore
}
+6 -3
View File
@@ -35,17 +35,20 @@ export function isTemporary(task: Task): boolean {
}
export function taskNextReset(task: Task): Date | null {
return nextCronReset(task.check_date, task.reset_cron, task.id);
return nextCronReset(task.check_date ?? new Date(), task.reset_cron, task.id);
}
export function taskFutureReset(task: Task): Date | null {
return nextCronReset(taskNextReset(task), task.reset_cron, task.id);
return nextCronReset(taskNextReset(task) ?? new Date(), task.reset_cron, task.id);
}
export function taskCompleted(task: Task): boolean {
if (task.check_date === null) {
return false;
}
const nextReset = taskNextReset(task);
if (nextReset === null) {
return task.check_date !== null;
return true;
}
return nextReset.getTime() > new Date().getTime();
}
Generated
+1 -1
View File
@@ -323,7 +323,7 @@ asyncpg = [
[[package]]
name = "tout-doux"
version = "1.6.1"
version = "1.7.0"
source = { editable = "." }
dependencies = [
{ name = "flask", extra = ["async"] },