nehakadam / AnyPicker

jQuery Picker Library for Android, iOS & Windows Phone. eg Date Picker, Time Picker, DateTime Picker, Custom Select etc
https://nehakadam.github.io/AnyPicker/
MIT License
116 stars 37 forks source link

when minValue and maxValue differ too small; #6

Closed tmeme closed 8 years ago

tmeme commented 8 years ago
$("#ip-de").AnyPicker(
                {
                    mode: "datetime",
                    viewSections:
                    {
                        header: [],
                        contentTop: [],
                        contentBottom: [],
                        footer: ["cancelButton", "headerTitle","setButton"]
                    },
                    i18n:{
                        headerTitle: "select",
                        setButton: "sure",
                        nowButton: "Now",
                        cancelButton: "cancel"
                    },
                    layout: "fixed",

                    dateTimeFormat: "yyyy-MM-dd",
                    theme:"iOS",
                    minValue: new Date("2016-05-06"),
                    maxValue: new Date(new Date("2016-05-06").getTime()+1000*60*60*24*7)
                });

image

nehakadam commented 8 years ago

Thank you for reporting a bug! Please download a latest version and check.

tmeme commented 8 years ago

fixed

tmeme commented 8 years ago

update to latest version when value change; 0undefinedundefinedundefined-undefinedundefinedundefined-undefinedundefinedundefined image

nehakadam commented 8 years ago

I could not reproduce error. Please check parameters of setOutput callback function in Documentation.

If error is not solved then post entire code the way you posted at first, so that I can check for a particular test case. Also mention OS, browser and browser version on which you are testing.

tmeme commented 8 years ago
<script type="text/javascript">

            $(document).ready(function()
            {

                $("#ip-de").AnyPicker(
                        {
                            mode: "datetime",
                            viewSections:
                            {
                                header: ["cancelButton", "headerTitle","setButton"],
                                contentTop: [],
                                contentBottom: [],
                                footer: ["cancelButton", "headerTitle","setButton"]
                            }, 
                            layout: "fixed",

                            dateTimeFormat: "yyyy-MM-dd",
                            theme:"iOS",
                            //rowHeight:108*(window.innerWidth || document.documentElement.clientWidth)/1242,
                            minValue: new Date(),
                            maxValue: new Date(new Date().getTime()+1000*60*60*24*7),
                            setOutput:function(val){
                                console.log(val);
                                if(!(new Date(val).getTime()) ){
                                    var s = new Date(new Date().getTime()+1000*60*60*24*1),
                                            year = s.getFullYear(),
                                            m = s.getMonth()+1 >10 ? s.getMonth()+1 : "0"+(s.getMonth()+1),
                                            d = s.getDay();
                                    val = year +"-"+m+"-"+d;
                                }
                                if(new Date(val).getTime() ){

                                }

                            }
                        });
            });

        </script>
<button  id="ip-de" readonly>button</button>

image

nehakadam commented 8 years ago

There is an issue with this when non-input element is used. If <input type="text" id="ip-de" readonly> is used then this issue is not detected.

nehakadam commented 8 years ago

I know it's too late but posting comment so that it may help someone else.

Please go through NonInputElement.htm as an example of implementing AnyPicker with Non Input Element.