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

@@ -10,7 +10,7 @@ import {
Typography,
} from "antd";
import axios from "axios";
import moment from "moment";
import dayjs from "../../utils/day";
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
@@ -68,7 +68,7 @@ export function ScheduleJobModalComponent({
if (values.start && !values.scheduled_completion)
form.setFieldsValue({
scheduled_completion: moment(values.start).businessAdd(
scheduled_completion: dayjs(values.start).businessAdd(
totalHours / bodyshop.target_touchtime,
"days"
),
@@ -134,11 +134,11 @@ export function ScheduleJobModalComponent({
className="imex-flex-row__margin"
key={idx}
onClick={() => {
const ssDate = moment(d);
if (ssDate.isBefore(moment())) {
form.setFieldsValue({ start: moment() });
const ssDate = dayjs(d);
if (ssDate.isBefore(dayjs())) {
form.setFieldsValue({ start: dayjs() });
} else {
form.setFieldsValue({ start: moment(d).add(8, "hours") });
form.setFieldsValue({ start: dayjs(d).add(8, "hours") });
}
handleDateBlur();
}}
@@ -201,7 +201,7 @@ export function ScheduleJobModalComponent({
{() => {
const values = form.getFieldsValue();
if (values.start) {
calculateScheduleLoad(moment(values.start).add(3, "days"));
calculateScheduleLoad(dayjs(values.start).add(3, "days"));
}
return (
<div className="schedule-job-modal">

View File

@@ -1,7 +1,6 @@
import { useMutation, useQuery } from "@apollo/client";
//import moment from "moment";
import { Form, Modal, notification } from "antd";
import moment from "moment-business-days";
import dayjs from "../../utils/day";
import React, { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
@@ -129,8 +128,8 @@ export function ScheduleJobModalContainer({
app: {
jobid: jobId,
bodyshopid: bodyshop.id,
start: moment(values.start),
end: moment(values.start).add(bodyshop.appt_length || 60, "minutes"),
start: dayjs(values.start),
end: dayjs(values.start).add(bodyshop.appt_length || 60, "minutes"),
color: values.color,
note: values.note,
created_by: currentUser.email,