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:
@@ -1,6 +1,6 @@
|
||||
import { useMutation, useQuery } from "@apollo/client";
|
||||
import { Form, notification } from "antd";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
@@ -139,19 +139,19 @@ export function ContractDetailPageContainer({
|
||||
initialValues={{
|
||||
...data.cccontracts_by_pk,
|
||||
start: data.cccontracts_by_pk.start
|
||||
? moment(data.cccontracts_by_pk.start)
|
||||
? dayjs(data.cccontracts_by_pk.start)
|
||||
: null,
|
||||
scheduledreturn: data.cccontracts_by_pk.scheduledreturn
|
||||
? moment(data.cccontracts_by_pk.scheduledreturn)
|
||||
? dayjs(data.cccontracts_by_pk.scheduledreturn)
|
||||
: null,
|
||||
actualreturn: data.cccontracts_by_pk.actualreturn
|
||||
? moment(data.cccontracts_by_pk.actualreturn)
|
||||
? dayjs(data.cccontracts_by_pk.actualreturn)
|
||||
: null,
|
||||
driver_dlexpiry: data.cccontracts_by_pk.driver_dlexpiry
|
||||
? moment(data.cccontracts_by_pk.driver_dlexpiry)
|
||||
? dayjs(data.cccontracts_by_pk.driver_dlexpiry)
|
||||
: null,
|
||||
driver_dob: data.cccontracts_by_pk.driver_dob
|
||||
? moment(data.cccontracts_by_pk.driver_dob)
|
||||
? dayjs(data.cccontracts_by_pk.driver_dob)
|
||||
: null,
|
||||
}}
|
||||
>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useMutation, useQuery } from "@apollo/client";
|
||||
import { Form, notification } from "antd";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
@@ -154,25 +154,25 @@ export function CourtesyCarDetailPageContainer({
|
||||
? {
|
||||
...data.courtesycars_by_pk,
|
||||
purchasedate: data.courtesycars_by_pk.purchasedate
|
||||
? moment(data.courtesycars_by_pk.purchasedate)
|
||||
? dayjs(data.courtesycars_by_pk.purchasedate)
|
||||
: null,
|
||||
servicestartdate: data.courtesycars_by_pk.servicestartdate
|
||||
? moment(data.courtesycars_by_pk.servicestartdate)
|
||||
? dayjs(data.courtesycars_by_pk.servicestartdate)
|
||||
: null,
|
||||
serviceenddate: data.courtesycars_by_pk.serviceenddate
|
||||
? moment(data.courtesycars_by_pk.serviceenddate)
|
||||
? dayjs(data.courtesycars_by_pk.serviceenddate)
|
||||
: null,
|
||||
leaseenddate: data.courtesycars_by_pk.leaseenddate
|
||||
? moment(data.courtesycars_by_pk.leaseenddate)
|
||||
? dayjs(data.courtesycars_by_pk.leaseenddate)
|
||||
: null,
|
||||
nextservicedate: data.courtesycars_by_pk.nextservicedate
|
||||
? moment(data.courtesycars_by_pk.nextservicedate)
|
||||
? dayjs(data.courtesycars_by_pk.nextservicedate)
|
||||
: null,
|
||||
registrationexpires: data.courtesycars_by_pk.registrationexpires
|
||||
? moment(data.courtesycars_by_pk.registrationexpires)
|
||||
? dayjs(data.courtesycars_by_pk.registrationexpires)
|
||||
: null,
|
||||
insuranceexpires: data.courtesycars_by_pk.insuranceexpires
|
||||
? moment(data.courtesycars_by_pk.insuranceexpires)
|
||||
? dayjs(data.courtesycars_by_pk.insuranceexpires)
|
||||
: null,
|
||||
}
|
||||
: {}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useQuery } from "@apollo/client";
|
||||
import { Col, Row, Typography } from "antd";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import React, { useEffect } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
@@ -66,7 +66,7 @@ export function JobsChecklistViewContainer({
|
||||
<div>
|
||||
{t("jobs.labels.checklistcompletedby", {
|
||||
by: checklist.completed_by,
|
||||
at: moment(checklist.completed_at).format("MM/DD/YYYY @ h:mm a"),
|
||||
at: dayjs(checklist.completed_at).format("MM/DD/YYYY @ h:mm a"),
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -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")
|
||||
)
|
||||
|
||||
@@ -19,7 +19,7 @@ import {
|
||||
import {PageHeader} from "@ant-design/pro-layout";
|
||||
|
||||
import Axios from "axios";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import queryString from "query-string";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
@@ -172,7 +172,7 @@ export function JobsDetailPage({
|
||||
jobid: job.id,
|
||||
operation: AuditTrailMapping.jobfieldchange(
|
||||
key,
|
||||
changedAuditFields[key] instanceof moment
|
||||
changedAuditFields[key] instanceof dayjs
|
||||
? DateTimeFormat(changedAuditFields[key])
|
||||
: changedAuditFields[key]
|
||||
),
|
||||
@@ -392,7 +392,7 @@ export default connect(mapStateToProps, mapDispatchToProps)(JobsDetailPage);
|
||||
const transormJobToForm = (job) => {
|
||||
return {
|
||||
...job,
|
||||
loss_date: job.loss_date ? moment(job.loss_date) : null,
|
||||
date_estimated: job.date_estimated ? moment(job.date_estimated) : null,
|
||||
loss_date: job.loss_date ? dayjs(job.loss_date) : null,
|
||||
date_estimated: job.date_estimated ? dayjs(job.date_estimated) : null,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useQuery } from "@apollo/client";
|
||||
import { Col, Row, Space } from "antd";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import React, { useEffect } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
@@ -36,9 +36,9 @@ export function TimeTicketsContainer({
|
||||
const { start, end } = Object.fromEntries(searchParams);
|
||||
|
||||
const startDate = start
|
||||
? moment(start)
|
||||
: moment().startOf("week").subtract(7, "days");
|
||||
const endDate = end ? moment(end) : moment().endOf("week");
|
||||
? dayjs(start)
|
||||
: dayjs().startOf("week").subtract(7, "days");
|
||||
const endDate = end ? dayjs(end) : dayjs().endOf("week");
|
||||
|
||||
const { loading, error, data } = useQuery(QUERY_TIME_TICKETS_IN_RANGE, {
|
||||
variables: {
|
||||
|
||||
Reference in New Issue
Block a user