Home Analytics

Working with Dates in Dashboard Designer Grids

David_DarlingDavid_Darling Customer IT Monkey ✭

Hi -- How are people dealing with the fact we can't convert dates in the grids to local time?


Thanks!

Best Answers

Answers

  • Tom_HendricksTom_Hendricks Customer Super IT Monkey ✭✭✭✭✭
    edited November 2016
    I haven't run across this yet (waiting to hit another milestone before using the dashboards), but if you are able to reference the grid cells with JavaScript, there is a function for converting them built into the portal:

    app.lib.getLocalDateFromUTCDate(yourDate)
    

    Running this from within $(document).ready(function() { .... }); should work, in theory, if you can iterate across the grid and plug in the yourDate (my name for it) param for date cells.

    Having said all of this, maybe someone else has a simpler way of accomplishing the same?
  • Geoff_RossGeoff_Ross Cireson Consultant Super IT Monkey ✭✭✭✭✭
    Here's the final result BTW.

  • Chris_StelzerChris_Stelzer Premier Partner IT Monkey ✭
    edited March 2017
    This date formatting doesn't work properly for date sorting. Using '111' appears to fix the sorting of dates in the grid views.

    SELECT WorkItemId, CONVERT(varchar,Created,111) + ' ' + CONVERT(varchar,DATEADD(hh,-6,Created),108) [Created_Date] From WorkItem
  • Brian_WiestBrian_Wiest Customer Super IT Monkey ✭✭✭✭✭
    Cireson released a fix with portal 7.3 that it adjusts the dates from UTC to local. 
    However there are some bugs that are scheduled to be fixed in 7.4 for other date columns. 
    I removed all the converts and it works on Create date column
    Of note when using the convert it changes to string so depending on your convert code it could sort in an unexpected manner. 
Sign In or Register to comment.