From fa73fedb73381fd3b7d62d32e49128c444ba9076 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Vinagre?= Date: Mon, 1 Oct 2018 07:18:27 -0300 Subject: [PATCH] fix(study-list): Change convertStringToStudyDate to use moment to fix study date issues --- .../studylistResult/studylistResult.js | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/Packages/ohif-study-list/client/components/studylist/studylistResult/studylistResult.js b/Packages/ohif-study-list/client/components/studylist/studylistResult/studylistResult.js index 38b4743c7..7e8f307f8 100644 --- a/Packages/ohif-study-list/client/components/studylist/studylistResult/studylistResult.js +++ b/Packages/ohif-study-list/client/components/studylist/studylistResult/studylistResult.js @@ -100,17 +100,6 @@ function replaceUndefinedColumnValue(text) { } } -/** - * Convert string to study date - */ -function convertStringToStudyDate(dateStr) { - const y = dateStr.substring(0, 4); - const m = dateStr.substring(4, 6); - const d = dateStr.substring(6, 8); - const newDateStr = m + '/' + d + '/' + y; - return new Date(newDateStr); -} - /** * Runs a search for studies matching the studylist query parameters * Inserts the identified studies into the Studies Collection @@ -168,12 +157,10 @@ function search() { } // Search the rest of the parameters that aren't done via the server call - if ((new Date(studyDateFrom).setHours(0, 0, 0, 0) <= studyDate || !studyDateFrom ) && - (studyDate <= new Date(studyDateTo).setHours(0, 0, 0, 0) || !studyDateTo || studyDateTo === '')) { - + if ((moment(studyDateFrom, "MM/DD/YYYY").isBefore(moment(studyDate, "YYYYMMDD")) || !studyDateFrom ) && + (moment(studyDate, "YYYYMMDD").isBefore(moment(studyDateTo, "MM/DD/YYYY")) || !studyDateTo || studyDateTo === '')) { // Convert numberOfStudyRelatedInstance string into integer study.numberOfStudyRelatedInstances = !isNaN(study.numberOfStudyRelatedInstances) ? parseInt(study.numberOfStudyRelatedInstances) : undefined; - // Insert any matching studies into the Studies Collection OHIF.studylist.collections.Studies.insert(study); }