console icon indicating copy to clipboard operation
console copied to clipboard

🐛 Bug Report: wrong 'next execution' for scheduled functions

Open FranciscoKloganB opened this issue 1 year ago • 1 comments

👟 Reproduction steps

  • Create a function on any Appwrite project
  • Access the newly created function settings and set it to run everyday at a given hour
    • For example, everyday at 2AM using the CRON Expression * 3 * * *
  • Access the functions dashboard
  • Find the function you just created
  • Using your mouse hover the "scheduled clock" icon
  • Verify that that the Next execution: ? is incorrect, e.g.: it says Next execution: Mar 1, 2000, 00:00, instead of saying Next execution: { today || tomorrow }, { year }, 03:00

👍 Expected behavior

It should display the correct date for the next execution:

0 1 * * * maps to Next execution: { today || tomorrow}, {year}, 01:00AM 0 2 * * * maps to Next execution: { today || tomorrow}, {year}, 02:00AM 0 3 * * * maps to Next execution: { today || tomorrow}, {year}, 03:00AM

👎 Actual Behavior

It displays the wrong date for the next execution:

0 1 * * * maps to Next execution: Jan 1, 2000, 00:00 0 2 * * * maps to Next execution: Feb 1, 2000, 00:00 0 3 * * * maps to Next execution: Mar 1, 2000, 00:00

🎲 Appwrite version

Appwrite Cloud

💻 Operating system

Something else

🧱 Your Environment

This issue can be replicated using only appwrite cloud without any other dependencies.

image

👀 Have you spent some time to check if this issue has been raised before?

  • [X] I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

FranciscoKloganB avatar Jan 18 '24 11:01 FranciscoKloganB

@FranciscoKloganB, thanks for creating this issue! 🙏 I have noticed some weird behavior with that. We'll have to look into it.

stnguyen90 avatar Jan 18 '24 17:01 stnguyen90

Some candidates for converting cron to human readable:

Package Stars Size Weekly Downloads
cronstrue 1.2k 1.14 MB 788K
cron-parser 1.3k 54.2 KB 2.9M

stnguyen90 avatar Jun 21 '24 23:06 stnguyen90