mirror of
https://github.com/gnmyt/myspeed.git
synced 2026-05-01 17:30:01 -05:00
Created the DropdownComponent.jsx utils
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import {parseExpression} from "cron-parser";
|
||||
|
||||
// Parses cron as a locale string
|
||||
export const parseCron = (cron) => {
|
||||
try {
|
||||
return parseExpression(cron).next().toDate().toLocaleString()
|
||||
} catch (e) {
|
||||
return <span className="icon-orange">Eingabe ungültig</span>;
|
||||
}
|
||||
}
|
||||
|
||||
// Fixes the cron provided by the user
|
||||
export const stringifyCron = (cron) => {
|
||||
try {
|
||||
return parseExpression(cron).stringify();
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user