jQWidgets Forums

jQuery UI Widgets Forums Grid Issue with date in column

This topic contains 3 replies, has 3 voices, and was last updated by  Peter Stoev 6 years, 11 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • Issue with date in column #101019

    CXXXV
    Participant

    I have the following column defined in a grid:

    { text: 'DATE', columngroup: 'USER', datafield: 'DATE', columntype: 'datetimeinput', cellsformat: 'yyyy-MM-dd', width: 110},

    The grid displays the value from the databes just fine. However, when clickinkg the datetime object it always displays one day less. So for instance the value is 2018-07-24, when opening the object it shows 208-07-23.

    What is really intriguing is that it only happens when clicking the cell the first time. It’s as if the datetime object does not really recognize the value in the cell.

    Issue with date in column #101020

    admin
    Keymaster

    Hi CXXXV,

    Javascript Date objects work with a Local Date. It may be one day less or one day more or the exact date if it is in the same time-zone. If your Date brings Time-Zone information, you can use it and it will be displayed in the way expected by you. How to do that is explained on this help tutorial: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-datasources.htm

    Best Regards,
    Peter Stoev

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

    Issue with date in column #101042

    CXXXV
    Participant

    Actually I don’t need time zone, hence the format of ‘yyyy-MMpdd’. So why does it care then. What is also curious is that I use them same setup in other grid without any issues. So where to I define to the jqxFrid columns that this is a date only and not datetime.

    Issue with date in column #101043

    Peter Stoev
    Keymaster

    Hi CXXXV,

    We use Javascript date objects i.e we use new Date(“some date string”) and set this date object to the Cell Editor, too. A date object is stored locally during the DataAdapter’s data binding, too. By doing new Date() the Date object is in local Time zone and that’s why there could be difference from what comes from the data source as a String during the reason that we use Date object and not a String for Dates. If everything is in one TimeZone, such issue would not occur.

    Best Regards,
    Peter Stoev

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

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

You must be logged in to reply to this topic.