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:
@@ -7,7 +7,7 @@ import ScoreboardTargetsTable from "../scoreboard-targets-table/scoreboard-targe
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import { useApolloClient, useQuery } from "@apollo/client";
|
||||
import {
|
||||
GET_BLOCKED_DAYS,
|
||||
@@ -28,8 +28,8 @@ export default connect(
|
||||
export function ScoreboardDisplayComponent({ bodyshop }) {
|
||||
const scoreboardSubscription = useQuery(QUERY_SCOREBOARD, {
|
||||
variables: {
|
||||
start: moment().startOf("month"),
|
||||
end: moment().endOf("month"),
|
||||
start: dayjs().startOf("month"),
|
||||
end: dayjs().endOf("month"),
|
||||
},
|
||||
pollInterval: 60000,
|
||||
});
|
||||
@@ -50,26 +50,26 @@ export function ScoreboardDisplayComponent({ bodyshop }) {
|
||||
|
||||
useEffect(() => {
|
||||
//Update the locals.
|
||||
async function setMomentSettings() {
|
||||
async function setDayJSSettings() {
|
||||
let appointments;
|
||||
|
||||
if (!bodyshop.scoreboard_target.ignoreblockeddays) {
|
||||
const { data } = await client.query({
|
||||
query: GET_BLOCKED_DAYS,
|
||||
variables: {
|
||||
start: moment().startOf("month"),
|
||||
end: moment().endOf("month"),
|
||||
start: dayjs().startOf("month"),
|
||||
end: dayjs().endOf("month"),
|
||||
},
|
||||
});
|
||||
appointments = data.appointments;
|
||||
}
|
||||
|
||||
moment.updateLocale("ca", {
|
||||
dayjs.updateLocale("ca", {
|
||||
workingWeekdays: translateSettingsToWorkingDays(bodyshop.workingdays),
|
||||
...(appointments
|
||||
? {
|
||||
holidays: appointments.map((h) =>
|
||||
moment(h.start).format("MM-DD-YYYY")
|
||||
dayjs(h.start).format("MM-DD-YYYY")
|
||||
),
|
||||
}
|
||||
: {}),
|
||||
@@ -77,7 +77,7 @@ export function ScoreboardDisplayComponent({ bodyshop }) {
|
||||
});
|
||||
}
|
||||
|
||||
setMomentSettings();
|
||||
setDayJSSettings();
|
||||
}, [client, bodyshop]);
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user