From 308a741ef0d5e574ff0e1bbc9edf390452ae205b Mon Sep 17 00:00:00 2001 From: Duncan MacKenzie Date: Wed, 24 Jul 2024 17:48:31 -0700 Subject: [PATCH] SCJ-249: Fix bookingTime string, remove ticks variables (#219) --- .../vue/HearingTimeSelect/HearingTimeSelect.vue | 17 +++-------------- app/Services/SC/ScCoreService.cs | 1 - app/Utils/ScSessionBookingInfo.cs | 1 - app/ViewModels/SC/ScAvailableTimesViewModel.cs | 7 ++----- 4 files changed, 5 insertions(+), 21 deletions(-) diff --git a/app/ClientSrc/vue/HearingTimeSelect/HearingTimeSelect.vue b/app/ClientSrc/vue/HearingTimeSelect/HearingTimeSelect.vue index 684f72b0..dfb4fbdd 100644 --- a/app/ClientSrc/vue/HearingTimeSelect/HearingTimeSelect.vue +++ b/app/ClientSrc/vue/HearingTimeSelect/HearingTimeSelect.vue @@ -126,22 +126,11 @@ export default { }, selectTime(containerId, bookingTime) { this.selectedContainerId = containerId; - this.selectedBookingTime = bookingTime; + // store booking time as an ISO 8601 string + this.selectedBookingTime = new Date(bookingTime).toISOString(); //check if date is still available - validateCaseDate(containerId, this.convertToTicks(bookingTime)); - }, - convertToTicks(dt) { - var date = new Date(dt); - var currentTime = date.getTime(); - - // 10,000 ticks in 1 millisecond - // jsTicks is number of ticks from midnight Jan 1, 1970 - var jsTicks = currentTime * 10000; - - // add 621355968000000000 to jsTicks - // netTicks is number of ticks from midnight Jan 1, 01 CE - return jsTicks + 621355968000000000; + validateCaseDate(containerId, bookingTime); }, }, created() { diff --git a/app/Services/SC/ScCoreService.cs b/app/Services/SC/ScCoreService.cs index afd0b25f..ce02338b 100644 --- a/app/Services/SC/ScCoreService.cs +++ b/app/Services/SC/ScCoreService.cs @@ -276,7 +276,6 @@ public async Task SaveAvailableTimesFormAsync(ScAvailableTimesViewModel model) if (model.ContainerId > 0) { - bookingInfo.SelectedConferenceDateTicks = model.SelectedConferenceDate; model.TimeSlotExpired = !IsTimeStillAvailable(schedule, model.ContainerId); bookingInfo.ContainerId = model.ContainerId; } diff --git a/app/Utils/ScSessionBookingInfo.cs b/app/Utils/ScSessionBookingInfo.cs index 23aa8060..9db0db05 100644 --- a/app/Utils/ScSessionBookingInfo.cs +++ b/app/Utils/ScSessionBookingInfo.cs @@ -28,7 +28,6 @@ public class ScSessionBookingInfo public int? EstimatedTrialLength { get; set; } public bool? IsHomeRegistry { get; set; } public bool? IsLocationChangeFiled { get; set; } - public string SelectedConferenceDateTicks { get; set; } public DateTime? SelectedRegularTrialDate { get; set; } public List SelectedFairUseTrialDates { get; set; } = new List() { }; diff --git a/app/ViewModels/SC/ScAvailableTimesViewModel.cs b/app/ViewModels/SC/ScAvailableTimesViewModel.cs index b9aad067..2d3b419f 100644 --- a/app/ViewModels/SC/ScAvailableTimesViewModel.cs +++ b/app/ViewModels/SC/ScAvailableTimesViewModel.cs @@ -152,12 +152,9 @@ public DateTime ParsedConferenceDate { var result = DateTime.MinValue; - if ( - !string.IsNullOrWhiteSpace(SelectedConferenceDate) - && long.TryParse(SelectedConferenceDate, out long ticks) - ) + if (!string.IsNullOrEmpty(SelectedConferenceDate)) { - result = new DateTime(ticks); + result = DateTime.Parse(SelectedConferenceDate); } return result; }