jQWidgets Forums

jQuery UI Widgets Forums Editors DateTimeInput JSON Date Format

This topic contains 1 reply, has 2 voices, and was last updated by  Peter Stoev 11 years, 11 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • JSON Date Format #21935

    FritzB
    Member

    Hi,

    I have an issue. I am using the DateTimeInput control to specify the date for an entry. I also use a jqxGrid to display some records that you can select.

    When you select a record, the form loads with the record information. (This all happens on one page). I use $.Ajax({}) to get the selected record and then proceed to populate the form with the JSON returned data.

    In my grid the date display as Day/Month/Year and that is how I need it displayed. When I click on a record, the DateTimeInput displayes the date as Month/Day/Year.

    The returned date is in JSON format and I use the following line with “moment.js” in order to format the date to display Day/Month/Year.

    var selectedDate = window.moment(data.srv_date).format(‘DD/MM/YYYY’);

    I add an alert box and confirm that the date is correct. Now I need to DateTimeInput to display that date but it keeps changing it to Month/Day/Year!! Here is the code where I assign the value to the datetimeinput.

    $(“#serviceDate”).jqxDateTimeInput(‘val’, selectedDate);

    My DateTimeInput box is configured like so when the page loads

    $(“#serviceDate”).jqxDateTimeInput({ width: 225, height: 25, theme: ‘web’, formatString: ‘dd/MM/yyyy’ });

    JSON Date Format #21942

    Peter Stoev
    Keymaster

    Hi,

    jqxDateTimeInput internally works with JavaScript Date object. I am not sure what “selectedDate” is in your code, but if it is not JavaScript Date object, then the widget will internally do something like: var d = new Date(selectedDate); If you could provide a more specific sample with exact values which will better illustrate your scenario, we would be glad to test it.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.