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,7 +1,7 @@
|
||||
import { useQuery } from "@apollo/client";
|
||||
import { Col, Row } from "antd";
|
||||
import _ from "lodash";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import queryString from "query-string";
|
||||
import React, { useMemo } from "react";
|
||||
import { useLocation } from "react-router-dom";
|
||||
@@ -16,22 +16,22 @@ export default function ScoreboardTimeTickets() {
|
||||
const searchParams = queryString.parse(useLocation().search);
|
||||
const { start, end } = 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 fixedPeriods = useMemo(() => {
|
||||
const endOfThisMonth = moment().endOf("month");
|
||||
const startofthisMonth = moment().startOf("month");
|
||||
const endOfThisMonth = dayjs().endOf("month");
|
||||
const startofthisMonth = dayjs().startOf("month");
|
||||
|
||||
const endOfLastmonth = moment().subtract(1, "month").endOf("month");
|
||||
const startOfLastmonth = moment().subtract(1, "month").startOf("month");
|
||||
const endOfLastmonth = dayjs().subtract(1, "month").endOf("month");
|
||||
const startOfLastmonth = dayjs().subtract(1, "month").startOf("month");
|
||||
|
||||
const endOfThisWeek = moment().endOf("week");
|
||||
const startOfThisWeek = moment().startOf("week");
|
||||
const endOfThisWeek = dayjs().endOf("week");
|
||||
const startOfThisWeek = dayjs().startOf("week");
|
||||
|
||||
const endOfLastWeek = moment().subtract(1, "week").endOf("week");
|
||||
const startOfLastWeek = moment().subtract(1, "week").startOf("week");
|
||||
const endOfLastWeek = dayjs().subtract(1, "week").endOf("week");
|
||||
const startOfLastWeek = dayjs().subtract(1, "week").startOf("week");
|
||||
|
||||
const allDates = [
|
||||
endOfThisMonth,
|
||||
@@ -43,8 +43,8 @@ export default function ScoreboardTimeTickets() {
|
||||
endOfLastWeek,
|
||||
startOfLastWeek,
|
||||
];
|
||||
const start = moment.min(allDates);
|
||||
const end = moment.max(allDates);
|
||||
const start = dayjs.min(allDates);
|
||||
const end = dayjs.max(allDates);
|
||||
return {
|
||||
start,
|
||||
end,
|
||||
@@ -85,7 +85,7 @@ export default function ScoreboardTimeTickets() {
|
||||
employees: {},
|
||||
};
|
||||
data.fixedperiod.forEach((ticket) => {
|
||||
const ticketDate = moment(ticket.date);
|
||||
const ticketDate = dayjs(ticket.date);
|
||||
|
||||
if (!ret.employees[ticket.employee.employee_number]) {
|
||||
ret.employees[ticket.employee.employee_number] = {
|
||||
@@ -167,7 +167,7 @@ export default function ScoreboardTimeTickets() {
|
||||
|
||||
listOfDays.forEach((day) => {
|
||||
const r = {
|
||||
date: moment(day).format("MM/DD"),
|
||||
date: dayjs(day).format("MM/DD"),
|
||||
actualtotal: 0,
|
||||
productivetotal: 0,
|
||||
employees: {},
|
||||
|
||||
Reference in New Issue
Block a user