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

after_or_equal / before_or_equal not working #378

Closed
Nuranto opened this issue Apr 7, 2019 · 4 comments · Fixed by #421
Closed

after_or_equal / before_or_equal not working #378

Nuranto opened this issue Apr 7, 2019 · 4 comments · Fixed by #421

Comments

@Nuranto
Copy link

Nuranto commented Apr 7, 2019

These rules seems to not be managed :
https://laravel.com/docs/5.8/validation#rule-after-or-equal
https://laravel.com/docs/5.8/validation#rule-before-or-equal

However, after and before seems to be managed 🤔

bytestream added a commit to bytestream/laravel-jsvalidation that referenced this issue Mar 15, 2020
@bytestream bytestream linked a pull request Mar 15, 2020 that will close this issue
bytestream added a commit that referenced this issue Mar 15, 2020
* Fixed #378

* single quotes
@Nuranto
Copy link
Author

Nuranto commented Apr 25, 2020

@bytestream
Does not work with today keyword (before_or_equal:today). Probably with other keywords as well.
Error is :

jsvalidation.js:1047 Uncaught TypeError: string.replace is not a function.  Exception occurred when checking element date_of_birth, check the 'laravelValidation' method.

Probably the problem occurs on Before/After too ?

@Nuranto
Copy link
Author

Nuranto commented Apr 25, 2020

Ugly fix to understand the issue :

        compareDates: function (validator, value, element, params, operator) {

            var timeCompare = parseFloat(params);
            
+            if(params == 'today') {  //todo manage also tomorrow and other keywords.
+               timeCompare = Date.now();
+            } 
+
            if (isNaN(timeCompare)) {
                var target = this.dependentElement(validator, element, params);

@bytestream
Copy link
Collaborator

Please can you open a fresh issue for those?

@garbinmarcelo
Copy link

Hello, has this problem been resolved? How to make "after_or_equal" work? Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants