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

Set two digits for month and days #84

Open
unusualious opened this issue Sep 29, 2021 · 2 comments
Open

Set two digits for month and days #84

unusualious opened this issue Sep 29, 2021 · 2 comments

Comments

@unusualious
Copy link

Hello, my problem is that inputs appear Persian date without zeros . for example if the number of a day or a month be less than 10 this appears only single number like 7 . but I need persian date in this cases write 07 in input .

@unusualious
Copy link
Author

unusualious commented Sep 29, 2021

                onSelect: function() {
                    var strr = $("#FromDate").attr("data-jdate");
                    if ((strr.length) < 10) {
                        var res = strr.split("/");
                        var result = "";
                        for (var i = 0; i < 3; i++) {
                            var l = res[i];
                            if ( l.length < 2)
                                res[i] = "0" + res[i];

                            if (result.length < 8)
                                result = result + res[i] + "/";
                            else
                                result = result + res[i];
                        }
                        console.log(res);
                        $("#FromDate").attr("data-jdate", result);
                        $("#FromDate").val(result);
                    }
                }

@arashveysi3
Copy link

just in the date format set it like this: YYYY/0M/0D thats all

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

No branches or pull requests

2 participants