public static function getSortKeyDate($dataItem, $key)
    {
        $variable = $variable = $key->getVariable();
        $part = $key->getRangePart();
        if (count($dataItem->{$variable}->{'date-parts'}) > 1) {
            //Date range
            $datePart = $dataItem->{$variable}->{'date-parts'}[$part];
            $sortKey = self::serializeDate($datePart);
            if ($key->getSort() === "descending" && $part === 0 ||
                $key->getSort() === "ascending" && $part === 1) {
                $sortKey .= "-";
            }
        } else {

            if (!isset($dataItem->{$variable}->{'date-parts'})) {
                $dateParts = self::parseDateParts($dataItem->{$variable});
            } else {
                $dateParts = $dataItem->{$variable}->{'date-parts'}[0];
            }
            $sortKey = self::serializeDate($dateParts);
        }
        return $sortKey;
    }