Javascript option-date vs getText-setText C1InputDate 2025v2 399

Posted by: enrique.pv-ext on 16 June 2026, 3:21 am EST

  • Posted 16 June 2026, 3:21 am EST

    Hi,

    Migrate from 2010v1 to 2025v2 399 in ASP.NET WebForms NET Framework 4.8.1.

    Using C1InputDate from C1.Web.Wijmo.Controls.48.dll

    Changes C1DateInput to C1InputDate control.

    using javascript functions-methods:

    var currentDate = new Date();
    
    dateBegin.c1inputdate('option', 'displayFormat', dateFormat);
    dateBegin.c1inputdate('option', 'dateFormat', dateFormat);
    dateBegin.c1inputdate('option', 'date', currentDate);
    
    var startDate = dateBegin.c1inputdate("option", "date");
    
    $("#<%= ShiftBeginDateText.ClientID %>").closest(".wijmo-wijinput").toggle();
    $("#<%= ShiftBeginDateText.ClientID %>").closest(".wijmo-wijinput").show();
    $("#<%= ShiftBeginDateText.ClientID %>").closest(".wijmo-wijinput").hide();
    return $("#<%= ShiftBeginDateText.ClientID %>").closest(".wijmo-wijinput").is(":visible");
    

    sample:

        this.ValidateClosePendingShiftDateEnd = function () {
            var isVisible = cts.ClosePendingShiftEndDateText.closest(".wijmo-wijinput").is(":visible");
            if (isVisible) { 
                var beginValue = cts.ShiftBeginDateText.c1inputdate("option", "date");
                var value = cts.ClosePendingShiftEndDateText.c1inputdate("option", "date");
                return value > beginValue;
            }
                return true;
        }

    references wijinputdate:

    https://help.grapecity.com/wijmo/3/webframe.html#Wijmo~jQuery.fn.-~wijinputdate.html

    I have seen public Methods:

    getPostValue Gets the text value when the container form is posted back to server.

    getSelectedText Gets the selected text.

    getText Gets the text displayed in the input box.

    isDateNull Determines whether the date is a null value.

    selectText Selects a range of text in the widget.

    setText Sets the text displayed in the input box.

    What is differences

    .c1inputdate(“option”, “date”);

    and methods getSelectedText, getText, selectText, setText ?

    thanks in advanced !!

  • Posted 16 June 2026, 5:37 am EST

    Hello Enrique,

    option(“date”) returns/sets a strongly-typed JavaScript ‘Date’ object directly — no parsing needed, and it respects whatever ‘dateFormat’/‘displayFormat’ is configured.

    ‘getText’/‘setText’ work on the raw displayed string in the input box. ‘getText’ gives you back a string you’d have to parse yourself (error-prone, especially if format/locale varies), and ‘setText’ just writes a string into the box without validating it’s a real date.

    ‘getSelectedText’/‘selectText’ are unrelated to the date value itself — they just manipulate text selection within the input (like a substring/highlight operation), useful for custom editing UX, not for getting/setting the actual date. If you use ‘getSelectedText’, it will return only the currently selected portion of the displayed date string, not the complete date string.

    So, for your ‘ValidateClosePendingShiftDateEnd’ comparison logic, using ‘option(“date”)’ (as you’re already doing) is correct — comparing ‘Date’ objects directly is reliable, whereas comparing via ‘getText’ strings would require you to parse both into dates first using ‘dateFormat’, adding unnecessary complexity and risk of mismatch.

    Regards,

    Uttkarsh.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels