Skip to content

Commit

Permalink
SCJ-249: Fix bookingTime string, remove ticks variables (#219)
Browse files Browse the repository at this point in the history
  • Loading branch information
duncan-oxd authored Jul 25, 2024
1 parent 54e2c42 commit 308a741
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 21 deletions.
17 changes: 3 additions & 14 deletions app/ClientSrc/vue/HearingTimeSelect/HearingTimeSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
1 change: 0 additions & 1 deletion app/Services/SC/ScCoreService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
1 change: 0 additions & 1 deletion app/Utils/ScSessionBookingInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<DateTime> SelectedFairUseTrialDates { get; set; } = new List<DateTime>() { };
Expand Down
7 changes: 2 additions & 5 deletions app/ViewModels/SC/ScAvailableTimesViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 308a741

Please sign in to comment.