This is a breaking change, moment is no longer with us, let us have a dayjs of silence.

Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
Dave Richer
2023-12-13 19:06:15 -05:00
parent 25173b0903
commit 65157a094f
97 changed files with 772 additions and 592 deletions

View File

@@ -25,7 +25,7 @@ import { connect } from "react-redux";
// import { useNavigate } from 'react-router-dom';
import { useTreatments } from "@splitsoftware/splitio-react";
import Dinero from "dinero.js";
import moment from "moment";
import dayjs from "../../utils/day";
import { Link } from "react-router-dom";
import { createStructuredSelector } from "reselect";
import DateTimePicker from "../../components/form-date-time-picker/form-date-time-picker.component";
@@ -137,17 +137,17 @@ export function JobsCloseComponent({ job, bodyshop, jobRO }) {
initialValues={{
joblines: job.joblines,
actual_in: job.actual_in
? moment(job.actual_in)
: job.scheduled_in && moment(job.scheduled_in),
? dayjs(job.actual_in)
: job.scheduled_in && dayjs(job.scheduled_in),
actual_completion: job.actual_completion
? moment(job.actual_completion)
: job.scheduled_completion && moment(job.scheduled_completion),
? dayjs(job.actual_completion)
: job.scheduled_completion && dayjs(job.scheduled_completion),
actual_delivery: job.actual_delivery
? moment(job.actual_delivery)
: job.scheduled_delivery && moment(job.scheduled_delivery),
? dayjs(job.actual_delivery)
: job.scheduled_delivery && dayjs(job.scheduled_delivery),
date_invoiced: job.date_invoiced
? moment(job.date_invoiced)
: moment(),
? dayjs(job.date_invoiced)
: dayjs(),
kmin: job.kmin,
kmout: job.kmout,
dms_allocation: job.dms_allocation,
@@ -259,7 +259,7 @@ export function JobsCloseComponent({ job, bodyshop, jobRO }) {
({ getFieldValue }) => ({
validator(_, value) {
if (!bodyshop.cdk_dealerid) return Promise.resolve();
if (!value || moment(value).isSameOrAfter(moment(), "day")) {
if (!value || dayjs(value).isSameOrAfter(dayjs(), "day")) {
return Promise.resolve();
}
return Promise.reject(
@@ -274,13 +274,13 @@ export function JobsCloseComponent({ job, bodyshop, jobRO }) {
bodyshop.accountingconfig.ClosingPeriod
) {
if (
moment(value).isSameOrAfter(
moment(
dayjs(value).isSameOrAfter(
dayjs(
bodyshop.accountingconfig.ClosingPeriod[0]
).startOf("day")
) &&
moment(value).isSameOrBefore(
moment(
dayjs(value).isSameOrBefore(
dayjs(
bodyshop.accountingconfig.ClosingPeriod[1]
).endOf("day")
)