Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parseString方法处理spring格式的cron时生成的fields错位了 #319

Open
OriginRing opened this issue Apr 11, 2023 · 0 comments · May be fixed by #320
Open

parseString方法处理spring格式的cron时生成的fields错位了 #319

OriginRing opened this issue Apr 11, 2023 · 0 comments · May be fixed by #320
Assignees
Labels

Comments

@OriginRing
Copy link

OriginRing commented Apr 11, 2023

const cron = '12 0 6 * * *';
console.log(parseString(cron).expressions[0]. fields);

控制台结果:

dayOfMonth: [6]
dayOfWeek: [0, 1, 2, 3, 4, 5, 6, 7]
hour: [0]
minute: [12]
month: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
second: [0]

正常结果:
second: [12]

parseString方法这里并没有判断spring格式的cron, 而是直接补 0

try {
    result = CronParser._parseEntry('0 ' + entry);
    response.expressions.push(result.interval);
} catch (err) {
    response.errors[entry] = err;
}

希望作者处理一下, 感谢!!!

@OriginRing OriginRing linked a pull request Apr 11, 2023 that will close this issue
@OriginRing OriginRing changed the title parseString generated seconds defaults to 0 parseString方法处理spring格式的cron时生成的fields错位了 Apr 11, 2023
@harrisiirak harrisiirak self-assigned this Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants