We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23703
    • 180 Posts
    I’m trying to sort by a date tv as described here

    http://ditto.modxcms.com/tutorials/sort-by-a-date-tv.html

    but I can’t get it to work. I’m using the following call
    [!Ditto? &language=`svenska` &tpl=`programpost` &startID=`58` &display=`all` &orderBy=`programstart ASC` &dateSource=`programstart` &dateFormat=`%A %d/%m %H.%M`!]

    The strange thing is that Ditto doesn’t seem to be able to find the "programstart" tv. It doesn’t sort by it and the dateSource returns "1970-01-01 00:00". The debug info under "Retrieved Data" shows every document with "programstart" and "tvprogramstart" (there is only one "programstart" tv, not two) and both are set to "false".
    Testpost (65)
    ditto_sort    	0
    id    	        65
    pagetitle       Testpost
    programstart    false
    published       1
    tvprogramstart 	false

    I’m using Ditto 2.1. "programstart" is of type "Date" and uses the unixtime widget. The "programstart" tv has a valid value in every document. The "programpost" template contains the [+date+] placeholder. I’ve played around with document permissions to no avail. Exchanging "programstart" for "editedon" makes Ditto behave as expected so the problem seems to be that Ditto can’t find the tv.
      • 10449
      • 956 Posts
      use sortBy + sortDir (ASC | DESC)
        • 23703
        • 180 Posts
        I used only sortBy at first and couldn’t get it to work. Looked around some more and tried with orderBy which didn’t make any difference. I don’t think the sorting is the issue. It works if I use "editedon". The problem is that Ditto doesn’t seem to find the "programstart" tv.
        I was probably a bit unclear in my first post as well. The formating works correctly so the date I get is "Thursday 01/01 01:00", ie unixtime=0 (GMT+1).
          • 23703
          • 180 Posts
          I knew it had to be me... smiley

          Once I realized that the date from the unixtime widget is stored in human readable form and not as a unix timestamp, everything was much easier. Oh well...