{"action":"created","issue":{"url":"https://api.github.com/repos/jquery-validation/jquery-validation/issues/2036","repository_url":"https://api.github.com/repos/jquery-validation/jquery-validation","labels_url":"https://api.github.com/repos/jquery-validation/jquery-validation/issues/2036/labels{/name}","comments_url":"https://api.github.com/repos/jquery-validation/jquery-validation/issues/2036/comments","events_url":"https://api.github.com/repos/jquery-validation/jquery-validation/issues/2036/events","html_url":"https://github.com/jquery-validation/jquery-validation/issues/2036","id":245131518,"number":2036,"title":"normalizeRules Number issue","user":{"login":"Looooooka","id":5222445,"avatar_url":"https://avatars2.githubusercontent.com/u/5222445?v=4","gravatar_id":"","url":"https://api.github.com/users/Looooooka","html_url":"https://github.com/Looooooka","followers_url":"https://api.github.com/users/Looooooka/followers","following_url":"https://api.github.com/users/Looooooka/following{/other_user}","gists_url":"https://api.github.com/users/Looooooka/gists{/gist_id}","starred_url":"https://api.github.com/users/Looooooka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Looooooka/subscriptions","organizations_url":"https://api.github.com/users/Looooooka/orgs","repos_url":"https://api.github.com/users/Looooooka/repos","events_url":"https://api.github.com/users/Looooooka/events{/privacy}","received_events_url":"https://api.github.com/users/Looooooka/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-07-24T16:11:02Z","updated_at":"2017-08-05T12:16:21Z","closed_at":"2017-08-05T12:16:05Z","body":"Using globalization on a .NET core problem.\r\nThe problem.\r\nAttribute data-val-range-min, max and all the others get their values localized (FINE WITH ME).\r\nSo data-val-range-min=\"0,01\" (I'm from Slovenia).\r\nThe problem is when normalizeRules is hit it normalizes using javascripts global Number function.\r\nThe only way I've been able to fix this is to override all calls with  Number(Globalize.parseNumber(\r\nPretty sure this should be handled somehow differently.\r\nPerhaps the \"parameters\" should have been somehow parset from the localized attribute value before that.\r\nDoes anyone have any idea what needs to be set to have that happen?\r\n\r\n\r\n`\r\n    $.validator.normalizeRules = function (rules, element) {\r\n\r\n        // Handle dependency check\r\n        $.each(rules, function (prop, val) {\r\n\r\n            // Ignore rule when param is explicitly false, eg. required:false\r\n            if (val === false) {\r\n                delete rules[prop];\r\n                return;\r\n            }\r\n            if (val.param || val.depends) {\r\n                var keepRule = true;\r\n                switch (typeof val.depends) {\r\n                    case \"string\":\r\n                        keepRule = !!$(val.depends, element.form).length;\r\n                        break;\r\n                    case \"function\":\r\n                        keepRule = val.depends.call(element, element);\r\n                        break;\r\n                }\r\n                if (keepRule) {\r\n                    rules[prop] = val.param !== undefined ? val.param : true;\r\n                } else {\r\n                    $.data(element.form, \"validator\").resetElements($(element));\r\n                    delete rules[prop];\r\n                }\r\n            }\r\n        });\r\n\r\n        // Evaluate parameters\r\n        $.each(rules, function (rule, parameter) {\r\n            rules[rule] = $.isFunction(parameter) && rule !== \"normalizer\" ? parameter(element) : parameter;\r\n        });\r\n\r\n        // Clean number parameters\r\n        $.each([\"minlength\", \"maxlength\"], function () {\r\n            if (rules[this]) {\r\n                rules[this] = Number(Globalize.parseNumber(rules[this]));\r\n            }\r\n        });\r\n        $.each([\"rangelength\", \"range\"], function () {\r\n            var parts;\r\n            if (rules[this]) {\r\n                if ($.isArray(rules[this])) {\r\n                    rules[this] = [Number(Globalize.parseNumber(rules[this][0])), Number(Globalize.parseNumber(rules[this][1]))];\r\n                } else if (typeof rules[this] === \"string\") {\r\n                    parts = rules[this].replace(/[\\[\\]]/g, \"\").split(/[\\s,]+/);\r\n                    rules[this] = [Number(Globalize.parseNumber(parts[0])), Number(Globalize.parseNumber(parts[1]))];\r\n                }\r\n            }\r\n        });\r\n\r\n        if ($.validator.autoCreateRanges) {\r\n\r\n            // Auto-create ranges\r\n            if (rules.min != null && rules.max != null) {\r\n                rules.range = [rules.min, rules.max];\r\n                delete rules.min;\r\n                delete rules.max;\r\n            }\r\n            if (rules.minlength != null && rules.maxlength != null) {\r\n                rules.rangelength = [rules.minlength, rules.maxlength];\r\n                delete rules.minlength;\r\n                delete rules.maxlength;\r\n            }\r\n        }\r\n\r\n        return rules;\r\n    };`"},"comment":{"url":"https://api.github.com/repos/jquery-validation/jquery-validation/issues/comments/320440500","html_url":"https://github.com/jquery-validation/jquery-validation/issues/2036#issuecomment-320440500","issue_url":"https://api.github.com/repos/jquery-validation/jquery-validation/issues/2036","id":320440500,"user":{"login":"staabm","id":120441,"avatar_url":"https://avatars2.githubusercontent.com/u/120441?v=4","gravatar_id":"","url":"https://api.github.com/users/staabm","html_url":"https://github.com/staabm","followers_url":"https://api.github.com/users/staabm/followers","following_url":"https://api.github.com/users/staabm/following{/other_user}","gists_url":"https://api.github.com/users/staabm/gists{/gist_id}","starred_url":"https://api.github.com/users/staabm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/staabm/subscriptions","organizations_url":"https://api.github.com/users/staabm/orgs","repos_url":"https://api.github.com/users/staabm/repos","events_url":"https://api.github.com/users/staabm/events{/privacy}","received_events_url":"https://api.github.com/users/staabm/received_events","type":"User","site_admin":false},"created_at":"2017-08-05T12:16:21Z","updated_at":"2017-08-05T12:16:21Z","body":"Will close for now. Feel free to ask further questions regarding this topic here. We can re-open if required."}}
{"actor":{"display_login":"staabm"}}