CASH-2468 make sure load session considers min date
CASH-2468 make sure load session considers min date from .net and saves it as null
This commit is contained in:
parent
d085ea900f
commit
d61fa1d825
2 changed files with 16 additions and 2 deletions
|
|
@ -1,3 +1,15 @@
|
|||
// .NET serializes an unset DateTime as DateTime.MinValue ("0001-01-01T00:00:00").
|
||||
// Treat that as "no date" so it doesn't masquerade as a real, validation-passing value.
|
||||
const DOTNET_MIN_DATE_PREFIX = "0001-01-01";
|
||||
|
||||
export function isDotNetMinDate(value) {
|
||||
return typeof value === "string" && value.startsWith(DOTNET_MIN_DATE_PREFIX);
|
||||
}
|
||||
|
||||
export function normalizeDotNetMinDate(value) {
|
||||
return isDotNetMinDate(value) ? null : value;
|
||||
}
|
||||
|
||||
export function getDateDifferenceInDays(startDate, endDate) {
|
||||
// Create date objects from the input strings
|
||||
var date1 = new Date(endDate);
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ import {
|
|||
getPromoCodeWithoutBundleIdentifier,
|
||||
removeCurrentlyActivePromoCodesFromInactivePromos,
|
||||
} from "@/helpers/promotions-helper";
|
||||
import { getDateDifferenceInDays } from "@/helpers/date-helper";
|
||||
import { getDateDifferenceInDays, normalizeDotNetMinDate } from "@/helpers/date-helper";
|
||||
import sharedMutations from "./vuex-shared-mutations/vuexSharedMutations";
|
||||
import {
|
||||
coverageStatus,
|
||||
|
|
@ -848,7 +848,9 @@ export const mutations = {
|
|||
state.order.damage.glassToReplace = sessionInformation.order.damage.glassToReplace;
|
||||
state.order.damage.isRepair = sessionInformation.order.damage.isRepair;
|
||||
state.order.damage.numberOfChips = sessionInformation.order.damage.numberOfChips;
|
||||
state.order.damage.dateOfLoss = sessionInformation.order.damage?.dateOfLoss;
|
||||
state.order.damage.dateOfLoss = normalizeDotNetMinDate(
|
||||
sessionInformation.order.damage?.dateOfLoss
|
||||
);
|
||||
state.order.damage.damageCause = sessionInformation.order.damage?.damageCause;
|
||||
|
||||
state.order.damage.partQuestionAnswers =
|
||||
|
|
|
|||
Loading…
Reference in a new issue