zaanposni / discord-masz

MASZ is a selfhostable highly sophisticated moderation bot for Discord. Includes a web dashboard and a discord bot.
https://discord.gg/5zjpzw6h3S
Other
71 stars 18 forks source link

time field in case creation has wrong regex not allowing 2x as hours #579

Closed zaanposni closed 10 months ago

KevinWardProf commented 1 year ago

Hey @zaanposni Could you provide a better description of the problem?

zaanposni commented 1 year ago

Hi @KevinWardProf

checkout this file at line 590. (same applies to the EditCase.svelte in the same directory)

This regex is wrong. I want this timepicker to allow 00:00 to 23:59 as valid time inputs. However, it marks 20:00 and similar stuff as invalid. Furthermore 29:00 is marked as a valid time.

If this time is omitted, the form and therefore the web request generates completely wrong resources. If the time is not set correctly to the backend, it is instead replaced with null which is wrong. I want the time field to be optional. If the user enters a date but no time or an invalid time I want the time to default to 12hours or similar.

Let me know if you want to work on this issue so I can assign it to you.

alefDev-prog commented 1 year ago

Hi, I think that this regular expression matches your wishes: /^([01]\d|2[0-3])(:)([0-5]\d)(:[0-5]\d)?$/

I could try to fix the other problems you are talking about tomorrow.

alefDev-prog commented 1 year ago

I'm sorry, made a mistake. This should be the correct regex: /^([01]\d|2[0-3]):[0-5]\d$/

I can make a pull request to change the current regex to the new one, and try to fix the issues with the time being set to null.

zaanposni commented 1 year ago

Sounds good, feel free to go ahead. Please target the release/3.5.0 branch.

zaanposni commented 10 months ago

fixed in 3.5.0