locked
Initial Value for DateTime Picker RRS feed

  • Question

  • User338455301 posted

    Hi,
    I Use this dateTime picker and i use asp.net core 

    http://babakhani.github.io/PersianWebToolkit/beta/datepicker/

    for example when i call edit page i dont want set new date for dateTimePicker i want just set my date on database 
    in local that is worked correctly but when i upload in host its now worked and when i call edit page set date time now in data picker dont set my date.

    $('#OfferDate').persianDatepicker({
            altField: '#tarikhAlt2',
        altFormat: 'X',
        format: 'D MMMM YYYY HH:mm:ss',
        observer: true, 
        autoClose: true,
        initialValue: false,
                timePicker: {
            enabled: true
    },
    });
    
    

    why this is worked on localhost but dont worked on host ???

    Sunday, March 17, 2019 9:26 PM

All replies

  • User839733648 posted

    Hi elahi1mahdi,

    in local that is worked correctly but when i upload in host its now worked and when i call edit page set date time now in data picker dont set my date.

    I'm confused about your description. Do you mean that you want to set the default date from your datebase to the datepicker?

    If so, I suggest that you could first find the date, and the use selectedDate attribute to set the default date.

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8" />
        <title></title>
        <link href="References/persianDatepicker-default.css" rel="stylesheet" />
        <script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
        <script src="References/persianDatepicker.min.js"></script>
        <script>
            $(function () {
                $("#input1").persianDatepicker({
                    months: ["فروردین", "اردیبهشت", "خرداد", "تیر", "مرداد", "شهریور", "مهر", "آبان", "آذر", "دی", "بهمن", "اسفند"],
                    dowTitle: ["شنبه", "یکشنبه", "دوشنبه", "سه شنبه", "چهارشنبه", "پنج شنبه", "جمعه"],
                    shortDowTitle: ["ش", "ی", "د", "س", "چ", "پ", "ج"],
                    showGregorianDate: !1,
                    persianNumbers: !0,
                    formatDate: "YYYY/MM/DD",
                    selectedBefore: !1,
                    selectedDate: "2007/12/27",
                    startDate: null,
                    endDate: null,
                    prevArrow: '\u25c4',
                    nextArrow: '\u25ba',
                    theme: 'default',
                    alwaysShow: !0,
                    selectableYears: null,
                    selectableMonths: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
                    cellWidth: 25, // by px
                    cellHeight: 20, // by px
                    fontSize: 13, // by px                
                    isRTL: !1,
                    calendarPosition: {
                        x: 0,
                        y: 0,
                    },
                    onShow: function () { },
                    onHide: function () { },
                    onSelect: function () { },
                    onRender: function () { }
                });
            })
        </script>
    </head>
    <body>
        <input type="text" id="input1" />
    </body>
    </html>

    result:

    Reference: http://behzadi.github.io/persianDatepicker/ 

    Best Regards,

    Jenifer

    Monday, March 18, 2019 6:27 AM