This will still sort ascending because `'D'` will evaluate to `true`, should be something like `getSortedData('date', false);`

Definition

    function getSortedData(field, asc) {
        key = field + (asc ? "A" : "D");