From 28c65f71b4a4110d422bbc2a13fff32ee923d6ec Mon Sep 17 00:00:00 2001 From: Mircea Nistor Date: Fri, 13 Oct 2023 14:55:38 +0200 Subject: [PATCH] fix(data-store-json): order credentials with weird issuanceDate (#1273) --- packages/data-store-json/src/data-store-json.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/data-store-json/src/data-store-json.ts b/packages/data-store-json/src/data-store-json.ts index 6d69cba9d..d5b391925 100644 --- a/packages/data-store-json/src/data-store-json.ts +++ b/packages/data-store-json/src/data-store-json.ts @@ -599,7 +599,9 @@ function buildQuery>>( const colA = a[col] const colB = b[col] if (typeof colA?.getTime === 'function') { - result = direction * (colA.getTime() - colB.getTime() || 0) + const aTime = colA.getTime() + const bTime = typeof colB?.getTime === 'function' ? colB.getTime() : 0 + result = direction * (aTime - bTime || 0) } else if (typeof colA?.localeCompare === 'function') { result = direction * colA.localeCompare(colB) } else {