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

@@ -4,9 +4,6 @@ const CracoLessPlugin = require("craco-less");
const SentryWebpackPlugin = require("@sentry/webpack-plugin");
const {convertLegacyToken} = require('@ant-design/compatible/lib');
const {theme} = require('antd/lib');
const {getLoader, loaderByName} = require("@craco/craco");
const AntdMomentWebpackPlugin = require("@ant-design/moment-webpack-plugin");
const {writeFile} = require("fs");
const {defaultAlgorithm, defaultSeed} = theme;
@@ -38,6 +35,7 @@ module.exports = {
lessOptions: {
modifyVars: {
...v4Token,
// TODO: This will no longer work in AntD 5.0
...(process.env.NODE_ENV === "development"
? {"colorPrimary": "#a51d1d"}
: {
@@ -66,7 +64,6 @@ module.exports = {
],
webpack: {
configure: (webpackConfig) => {
// config.plugins.push(new AntdMomentWebpackPlugin());
return {
...webpackConfig,
// Required for Dev Server

342
client/package-lock.json generated
View File

@@ -15,14 +15,16 @@
"@craco/craco": "^7.1.0",
"@fingerprintjs/fingerprintjs": "^4.2.1",
"@jsreport/browser-client": "^3.1.0",
"@sentry/react": "^7.86.0",
"@sentry/tracing": "^7.86.0",
"@sentry/react": "^7.87.0",
"@sentry/tracing": "^7.87.0",
"@splitsoftware/splitio-react": "^1.10.2",
"@tanem/react-nprogress": "^5.0.51",
"antd": "^5.12.2",
"apollo-link-logger": "^2.0.1",
"axios": "^1.3.6",
"craco-less": "^3.0.1",
"dayjs": "^1.11.10",
"dayjs-business-days2": "^1.2.2",
"dinero.js": "^1.9.1",
"dotenv": "^16.3.1",
"enquire-js": "^0.2.1",
@@ -37,8 +39,6 @@
"libphonenumber-js": "^1.10.51",
"logrocket": "^7.0.0",
"markerjs2": "^2.31.4",
"moment-business-days": "^1.2.0",
"moment-timezone": "^0.5.43",
"normalize-url": "^8.0.0",
"phone": "^3.1.41",
"preval.macro": "^5.0.0",
@@ -61,7 +61,7 @@
"react-number-format": "^5.1.4",
"react-redux": "^9.0.4",
"react-resizable": "^3.0.5",
"react-router-dom": "^6.20.1",
"react-router-dom": "^6.21.0",
"react-scripts": "^5.0.1",
"react-sticky": "^6.0.3",
"react-sublime-video": "^0.2.5",
@@ -93,7 +93,6 @@
"yauzl": "^2.10.0"
},
"devDependencies": {
"@ant-design/moment-webpack-plugin": "^0.0.4",
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@sentry/webpack-plugin": "^2.10.2",
"@testing-library/cypress": "^10.0.1",
@@ -162,11 +161,6 @@
"react-dom": ">=16.0.0"
}
},
"node_modules/@ant-design/compatible/node_modules/dayjs": {
"version": "1.11.10",
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.10.tgz",
"integrity": "sha512-vjAczensTgRcqDERK0SR2XMwsF/tSvnvlv6VcF2GIhg6Sx4yOIt/irsr1RDJsKiIyBzJDpCoXiWWq28MqH2cnQ=="
},
"node_modules/@ant-design/css-animation": {
"version": "1.7.3",
"resolved": "https://registry.npmjs.org/@ant-design/css-animation/-/css-animation-1.7.3.tgz",
@@ -214,12 +208,6 @@
"resolved": "https://registry.npmjs.org/@ant-design/icons-svg/-/icons-svg-4.3.1.tgz",
"integrity": "sha512-4QBZg8ccyC6LPIRii7A0bZUk3+lEDCLnhB+FVsflGdcWPPmV+j3fire4AwwoqHV/BibgvBmR9ZIo4s867smv+g=="
},
"node_modules/@ant-design/moment-webpack-plugin": {
"version": "0.0.4",
"resolved": "https://registry.npmjs.org/@ant-design/moment-webpack-plugin/-/moment-webpack-plugin-0.0.4.tgz",
"integrity": "sha512-qZe5lakKA9DhyEzmv8gJ8xgDSaVYQG5YuHdxSbXIkrT7L0kTgfuVBBLuPJAqmBBgjW/x3QIlM/Hsd5T6/4GHVw==",
"dev": true
},
"node_modules/@ant-design/pro-layout": {
"version": "7.17.16",
"resolved": "https://registry.npmjs.org/@ant-design/pro-layout/-/pro-layout-7.17.16.tgz",
@@ -284,11 +272,6 @@
"react-dom": ">=17.0.0"
}
},
"node_modules/@ant-design/pro-utils/node_modules/dayjs": {
"version": "1.11.10",
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.10.tgz",
"integrity": "sha512-vjAczensTgRcqDERK0SR2XMwsF/tSvnvlv6VcF2GIhg6Sx4yOIt/irsr1RDJsKiIyBzJDpCoXiWWq28MqH2cnQ=="
},
"node_modules/@ant-design/react-slick": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@ant-design/react-slick/-/react-slick-1.0.2.tgz",
@@ -4390,9 +4373,9 @@
"integrity": "sha512-1dgmkh+3so0+LlBWRhGA33ua4MYr7tUOj+a9Si28vUi0IUFNbff1T3sgpeDJI/LaC75bBYnQ0A3wXjn0OrRNBA=="
},
"node_modules/@remix-run/router": {
"version": "1.13.1",
"resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.13.1.tgz",
"integrity": "sha512-so+DHzZKsoOcoXrILB4rqDkMDy7NLMErRdOxvzvOKb507YINKUP4Di+shbTZDhSE/pBZ+vr7XGIpcOO0VLSA+Q==",
"version": "1.14.0",
"resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.14.0.tgz",
"integrity": "sha512-WOHih+ClN7N8oHk9N4JUiMxQJmRVaOxcg8w7F/oHUXzJt920ekASLI/7cYX8XkntDWRhLZtsk6LbGrkgOAvi5A==",
"engines": {
"node": ">=14.0.0"
}
@@ -4496,22 +4479,54 @@
"integrity": "sha512-2/U3GXA6YiPYQDLGwtGlnNgKYBSwCFIHf8Y9LUY5VATHdtbLlU0Y1R3QoBnT0aB4qv/BEiVVsj7LJXoQCgJ2vA=="
},
"node_modules/@sentry-internal/feedback": {
"version": "7.86.0",
"resolved": "https://registry.npmjs.org/@sentry-internal/feedback/-/feedback-7.86.0.tgz",
"integrity": "sha512-6rl0JYjmAKnhm4/fuFaROh4Ht8oi9f6ZeIcViCuGJcrGICZJJY0s+R77XJI78rNa82PYFrSCcnWXcGji4T8E7g==",
"version": "7.87.0",
"resolved": "https://registry.npmjs.org/@sentry-internal/feedback/-/feedback-7.87.0.tgz",
"integrity": "sha512-31nvAvcchoBQJoZSxAaMh6FOLIoZEbTOGutiMTPzPLhL4bQF4fNl20Bc/mRD1IL/L7hyKsIl2ahxKjo1ZFbPfg==",
"dependencies": {
"@sentry/core": "7.86.0",
"@sentry/types": "7.86.0",
"@sentry/utils": "7.86.0"
"@sentry/core": "7.87.0",
"@sentry/types": "7.87.0",
"@sentry/utils": "7.87.0"
},
"engines": {
"node": ">=12"
}
},
"node_modules/@sentry-internal/feedback/node_modules/@sentry/core": {
"version": "7.87.0",
"resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.87.0.tgz",
"integrity": "sha512-jkoXqK/nuYh8DYS+n7uaSuSIdw4HJemyRkXsWjAEPtEgD7taGMafZGbP5pl+XE38SE59jTBxmKnkUEZOFMgZGA==",
"dependencies": {
"@sentry/types": "7.87.0",
"@sentry/utils": "7.87.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/@sentry-internal/feedback/node_modules/@sentry/types": {
"version": "7.87.0",
"resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.87.0.tgz",
"integrity": "sha512-w8jKFHq/Llupmr2FezmFgQsnm3y/CnqLjb7s6PstI78E409wrhH7p7oqX/OEuzccH1qNCNwes/3QKvPTRQDB4Q==",
"engines": {
"node": ">=8"
}
},
"node_modules/@sentry-internal/feedback/node_modules/@sentry/utils": {
"version": "7.87.0",
"resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.87.0.tgz",
"integrity": "sha512-7xgtPTnTNP/4IznFMFXxltuaXfLvzznrYCDMv9ny8EeUjJqlLX3CVA8Qq3YALsLCQCKcrGRARbAcd/EGG//w2w==",
"dependencies": {
"@sentry/types": "7.87.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/@sentry-internal/tracing": {
"version": "7.86.0",
"resolved": "https://registry.npmjs.org/@sentry-internal/tracing/-/tracing-7.86.0.tgz",
"integrity": "sha512-b4dUsNWlPWRwakGwR7bhOkqiFlqQszH1hhVFwrm/8s3kqEBZ+E4CeIfCvuHBHQ1cM/fx55xpXX/BU163cy+3iQ==",
"dev": true,
"dependencies": {
"@sentry/core": "7.86.0",
"@sentry/types": "7.86.0",
@@ -4522,16 +4537,60 @@
}
},
"node_modules/@sentry/browser": {
"version": "7.86.0",
"resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-7.86.0.tgz",
"integrity": "sha512-nfYWpVOmug+W7KJO7/xhA1JScMZcYHcoOVHLsUFm4znx51U4qZEk+zZDM11Q2Nw6MuDyEYg6bsH1QCwaoC6nLw==",
"version": "7.87.0",
"resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-7.87.0.tgz",
"integrity": "sha512-+WVqIns2ZFF/tsjNf90Km3eIKUd6lGQSsBQ+cVa05v0ebMr5OtnOkKlOHN4CJZ0gT0lyDnNHoys9Af6edIbE1Q==",
"dependencies": {
"@sentry-internal/feedback": "7.86.0",
"@sentry-internal/tracing": "7.86.0",
"@sentry/core": "7.86.0",
"@sentry/replay": "7.86.0",
"@sentry/types": "7.86.0",
"@sentry/utils": "7.86.0"
"@sentry-internal/feedback": "7.87.0",
"@sentry-internal/tracing": "7.87.0",
"@sentry/core": "7.87.0",
"@sentry/replay": "7.87.0",
"@sentry/types": "7.87.0",
"@sentry/utils": "7.87.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/@sentry/browser/node_modules/@sentry-internal/tracing": {
"version": "7.87.0",
"resolved": "https://registry.npmjs.org/@sentry-internal/tracing/-/tracing-7.87.0.tgz",
"integrity": "sha512-HYa0+rfFmYQ/DadXoiuarTSxrcnYDCd/fm0pFuOHjICtfja8IcLegVYP2/r3CgwB+IjquCtJ5kDcqS/NTgUcpA==",
"dependencies": {
"@sentry/core": "7.87.0",
"@sentry/types": "7.87.0",
"@sentry/utils": "7.87.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/@sentry/browser/node_modules/@sentry/core": {
"version": "7.87.0",
"resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.87.0.tgz",
"integrity": "sha512-jkoXqK/nuYh8DYS+n7uaSuSIdw4HJemyRkXsWjAEPtEgD7taGMafZGbP5pl+XE38SE59jTBxmKnkUEZOFMgZGA==",
"dependencies": {
"@sentry/types": "7.87.0",
"@sentry/utils": "7.87.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/@sentry/browser/node_modules/@sentry/types": {
"version": "7.87.0",
"resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.87.0.tgz",
"integrity": "sha512-w8jKFHq/Llupmr2FezmFgQsnm3y/CnqLjb7s6PstI78E409wrhH7p7oqX/OEuzccH1qNCNwes/3QKvPTRQDB4Q==",
"engines": {
"node": ">=8"
}
},
"node_modules/@sentry/browser/node_modules/@sentry/utils": {
"version": "7.87.0",
"resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.87.0.tgz",
"integrity": "sha512-7xgtPTnTNP/4IznFMFXxltuaXfLvzznrYCDMv9ny8EeUjJqlLX3CVA8Qq3YALsLCQCKcrGRARbAcd/EGG//w2w==",
"dependencies": {
"@sentry/types": "7.87.0"
},
"engines": {
"node": ">=8"
@@ -4703,6 +4762,7 @@
"version": "7.86.0",
"resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.86.0.tgz",
"integrity": "sha512-SbLvqd1bRYzhDS42u7GMnmbDMfth/zRiLElQWbLK/shmuZzTcfQSwNNdF4Yj+VfjOkqPFgGmICHSHVUc9dh01g==",
"dev": true,
"dependencies": {
"@sentry/types": "7.86.0",
"@sentry/utils": "7.86.0"
@@ -4728,13 +4788,13 @@
}
},
"node_modules/@sentry/react": {
"version": "7.86.0",
"resolved": "https://registry.npmjs.org/@sentry/react/-/react-7.86.0.tgz",
"integrity": "sha512-2bHi+YcG4cT+4xHXXzv+AZpU3pdPUlDBorSgHOpa9At4yxr17UWW2f8bP9wPYRgj+NEIM3YhDgR46FlBu9GSKg==",
"version": "7.87.0",
"resolved": "https://registry.npmjs.org/@sentry/react/-/react-7.87.0.tgz",
"integrity": "sha512-37O4Tr7Ij1T6B3eAKrlsLCkxjW+euHDRaDjjuD0gxYEyf4Tr+kx6x7s3x9wXZpkkehJCTCOflDSvYM7qH4uRFA==",
"dependencies": {
"@sentry/browser": "7.86.0",
"@sentry/types": "7.86.0",
"@sentry/utils": "7.86.0",
"@sentry/browser": "7.87.0",
"@sentry/types": "7.87.0",
"@sentry/utils": "7.87.0",
"hoist-non-react-statics": "^3.3.2"
},
"engines": {
@@ -4744,26 +4804,133 @@
"react": "15.x || 16.x || 17.x || 18.x"
}
},
"node_modules/@sentry/replay": {
"version": "7.86.0",
"resolved": "https://registry.npmjs.org/@sentry/replay/-/replay-7.86.0.tgz",
"integrity": "sha512-YYZO8bfQSx1H87Te/zzyHPLHvExWiYwUfMWW68yGX+PPZIIzxaM81/iCQHkoucxlvuPCOtxCgf7RSMbsnqEa8g==",
"node_modules/@sentry/react/node_modules/@sentry/types": {
"version": "7.87.0",
"resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.87.0.tgz",
"integrity": "sha512-w8jKFHq/Llupmr2FezmFgQsnm3y/CnqLjb7s6PstI78E409wrhH7p7oqX/OEuzccH1qNCNwes/3QKvPTRQDB4Q==",
"engines": {
"node": ">=8"
}
},
"node_modules/@sentry/react/node_modules/@sentry/utils": {
"version": "7.87.0",
"resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.87.0.tgz",
"integrity": "sha512-7xgtPTnTNP/4IznFMFXxltuaXfLvzznrYCDMv9ny8EeUjJqlLX3CVA8Qq3YALsLCQCKcrGRARbAcd/EGG//w2w==",
"dependencies": {
"@sentry-internal/tracing": "7.86.0",
"@sentry/core": "7.86.0",
"@sentry/types": "7.86.0",
"@sentry/utils": "7.86.0"
"@sentry/types": "7.87.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/@sentry/replay": {
"version": "7.87.0",
"resolved": "https://registry.npmjs.org/@sentry/replay/-/replay-7.87.0.tgz",
"integrity": "sha512-QinY5uYARRkZsdInNy8cFY4p/H697DutRdpWEIi/v7hsOiRVRxIVZ3n8dJxVIpPbVQ9upI19s/J3bb4mSERLSg==",
"dependencies": {
"@sentry-internal/tracing": "7.87.0",
"@sentry/core": "7.87.0",
"@sentry/types": "7.87.0",
"@sentry/utils": "7.87.0"
},
"engines": {
"node": ">=12"
}
},
"node_modules/@sentry/tracing": {
"version": "7.86.0",
"resolved": "https://registry.npmjs.org/@sentry/tracing/-/tracing-7.86.0.tgz",
"integrity": "sha512-WPqgmbLm6ntpIoTZd1L/RHIVEDMmvVjIDxKeXGiJeXHZG2VMtgwoxuZAFluVFaD0Sr20Nhj+ZS7HvKOWTxrjjA==",
"node_modules/@sentry/replay/node_modules/@sentry-internal/tracing": {
"version": "7.87.0",
"resolved": "https://registry.npmjs.org/@sentry-internal/tracing/-/tracing-7.87.0.tgz",
"integrity": "sha512-HYa0+rfFmYQ/DadXoiuarTSxrcnYDCd/fm0pFuOHjICtfja8IcLegVYP2/r3CgwB+IjquCtJ5kDcqS/NTgUcpA==",
"dependencies": {
"@sentry-internal/tracing": "7.86.0"
"@sentry/core": "7.87.0",
"@sentry/types": "7.87.0",
"@sentry/utils": "7.87.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/@sentry/replay/node_modules/@sentry/core": {
"version": "7.87.0",
"resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.87.0.tgz",
"integrity": "sha512-jkoXqK/nuYh8DYS+n7uaSuSIdw4HJemyRkXsWjAEPtEgD7taGMafZGbP5pl+XE38SE59jTBxmKnkUEZOFMgZGA==",
"dependencies": {
"@sentry/types": "7.87.0",
"@sentry/utils": "7.87.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/@sentry/replay/node_modules/@sentry/types": {
"version": "7.87.0",
"resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.87.0.tgz",
"integrity": "sha512-w8jKFHq/Llupmr2FezmFgQsnm3y/CnqLjb7s6PstI78E409wrhH7p7oqX/OEuzccH1qNCNwes/3QKvPTRQDB4Q==",
"engines": {
"node": ">=8"
}
},
"node_modules/@sentry/replay/node_modules/@sentry/utils": {
"version": "7.87.0",
"resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.87.0.tgz",
"integrity": "sha512-7xgtPTnTNP/4IznFMFXxltuaXfLvzznrYCDMv9ny8EeUjJqlLX3CVA8Qq3YALsLCQCKcrGRARbAcd/EGG//w2w==",
"dependencies": {
"@sentry/types": "7.87.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/@sentry/tracing": {
"version": "7.87.0",
"resolved": "https://registry.npmjs.org/@sentry/tracing/-/tracing-7.87.0.tgz",
"integrity": "sha512-oEj4wo5K9WSyYgMInM/DA5DToS0F/dz2PNe5dkhIdEkMGTarSvLm7DIo3L44NfYUtj4DrKyMM61vXHNIeQitVg==",
"dependencies": {
"@sentry-internal/tracing": "7.87.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/@sentry/tracing/node_modules/@sentry-internal/tracing": {
"version": "7.87.0",
"resolved": "https://registry.npmjs.org/@sentry-internal/tracing/-/tracing-7.87.0.tgz",
"integrity": "sha512-HYa0+rfFmYQ/DadXoiuarTSxrcnYDCd/fm0pFuOHjICtfja8IcLegVYP2/r3CgwB+IjquCtJ5kDcqS/NTgUcpA==",
"dependencies": {
"@sentry/core": "7.87.0",
"@sentry/types": "7.87.0",
"@sentry/utils": "7.87.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/@sentry/tracing/node_modules/@sentry/core": {
"version": "7.87.0",
"resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.87.0.tgz",
"integrity": "sha512-jkoXqK/nuYh8DYS+n7uaSuSIdw4HJemyRkXsWjAEPtEgD7taGMafZGbP5pl+XE38SE59jTBxmKnkUEZOFMgZGA==",
"dependencies": {
"@sentry/types": "7.87.0",
"@sentry/utils": "7.87.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/@sentry/tracing/node_modules/@sentry/types": {
"version": "7.87.0",
"resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.87.0.tgz",
"integrity": "sha512-w8jKFHq/Llupmr2FezmFgQsnm3y/CnqLjb7s6PstI78E409wrhH7p7oqX/OEuzccH1qNCNwes/3QKvPTRQDB4Q==",
"engines": {
"node": ">=8"
}
},
"node_modules/@sentry/tracing/node_modules/@sentry/utils": {
"version": "7.87.0",
"resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.87.0.tgz",
"integrity": "sha512-7xgtPTnTNP/4IznFMFXxltuaXfLvzznrYCDMv9ny8EeUjJqlLX3CVA8Qq3YALsLCQCKcrGRARbAcd/EGG//w2w==",
"dependencies": {
"@sentry/types": "7.87.0"
},
"engines": {
"node": ">=8"
@@ -4773,6 +4940,7 @@
"version": "7.86.0",
"resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.86.0.tgz",
"integrity": "sha512-pGAt0+bMfWgo0KG2epthfNV4Wae03tURpoxNjGo5Fr4cXxvLTSijSAQ6rmmO4bXBJ7+rErEjX30g30o/eEdP9g==",
"dev": true,
"engines": {
"node": ">=8"
}
@@ -4781,6 +4949,7 @@
"version": "7.86.0",
"resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.86.0.tgz",
"integrity": "sha512-6PejFtw9VTFFy5vu0ks+U7Ozkqz+eMt+HN8AZKBKErYzX5/xs0kpkOcSRpu3ETdTYcZf8VAmLVgFgE2BE+3WuQ==",
"dev": true,
"dependencies": {
"@sentry/types": "7.86.0"
},
@@ -6404,11 +6573,6 @@
"react-dom": ">=16.9.0"
}
},
"node_modules/antd/node_modules/dayjs": {
"version": "1.11.10",
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.10.tgz",
"integrity": "sha512-vjAczensTgRcqDERK0SR2XMwsF/tSvnvlv6VcF2GIhg6Sx4yOIt/irsr1RDJsKiIyBzJDpCoXiWWq28MqH2cnQ=="
},
"node_modules/any-promise": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz",
@@ -8582,12 +8746,6 @@
"undici-types": "~5.26.4"
}
},
"node_modules/cypress/node_modules/dayjs": {
"version": "1.11.10",
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.10.tgz",
"integrity": "sha512-vjAczensTgRcqDERK0SR2XMwsF/tSvnvlv6VcF2GIhg6Sx4yOIt/irsr1RDJsKiIyBzJDpCoXiWWq28MqH2cnQ==",
"dev": true
},
"node_modules/cypress/node_modules/proxy-from-env": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.0.0.tgz",
@@ -8799,6 +8957,19 @@
"resolved": "https://registry.npmjs.org/date-arithmetic/-/date-arithmetic-4.1.0.tgz",
"integrity": "sha512-QWxYLR5P/6GStZcdem+V1xoto6DMadYWpMXU82ES3/RfR3Wdwr3D0+be7mgOJ+Ov0G9D5Dmb9T17sNLQYj9XOg=="
},
"node_modules/dayjs": {
"version": "1.11.10",
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.10.tgz",
"integrity": "sha512-vjAczensTgRcqDERK0SR2XMwsF/tSvnvlv6VcF2GIhg6Sx4yOIt/irsr1RDJsKiIyBzJDpCoXiWWq28MqH2cnQ=="
},
"node_modules/dayjs-business-days2": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/dayjs-business-days2/-/dayjs-business-days2-1.2.2.tgz",
"integrity": "sha512-tYwNKeMxuNEpGw2k5j/KTcH0c1lV+41wfqkTN21OvP2hwZFnpM4dH2biaOI2gElRmJOQQxkKByuH5bZPlea/Jg==",
"dependencies": {
"dayjs": "^1.11.10"
}
},
"node_modules/debug": {
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
@@ -14781,14 +14952,6 @@
"node": "*"
}
},
"node_modules/moment-business-days": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/moment-business-days/-/moment-business-days-1.2.0.tgz",
"integrity": "sha512-QJlceLfMSxy/jZSOgJYCKeKw+qGYHj8W0jMa/fYruyoJ85+bJuLRiYv5DIaflyuRipmYRfD4kDlSwVYteLN+Jw==",
"peerDependencies": {
"moment": "2.x.x"
}
},
"node_modules/moment-timezone": {
"version": "0.5.43",
"resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.43.tgz",
@@ -17954,11 +18117,6 @@
"react-dom": "^16.14.0 || ^17 || ^18"
}
},
"node_modules/react-big-calendar/node_modules/dayjs": {
"version": "1.11.10",
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.10.tgz",
"integrity": "sha512-vjAczensTgRcqDERK0SR2XMwsF/tSvnvlv6VcF2GIhg6Sx4yOIt/irsr1RDJsKiIyBzJDpCoXiWWq28MqH2cnQ=="
},
"node_modules/react-big-calendar/node_modules/memoize-one": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/memoize-one/-/memoize-one-6.0.0.tgz",
@@ -18276,11 +18434,11 @@
}
},
"node_modules/react-router": {
"version": "6.20.1",
"resolved": "https://registry.npmjs.org/react-router/-/react-router-6.20.1.tgz",
"integrity": "sha512-ccvLrB4QeT5DlaxSFFYi/KR8UMQ4fcD8zBcR71Zp1kaYTC5oJKYAp1cbavzGrogwxca+ubjkd7XjFZKBW8CxPA==",
"version": "6.21.0",
"resolved": "https://registry.npmjs.org/react-router/-/react-router-6.21.0.tgz",
"integrity": "sha512-hGZ0HXbwz3zw52pLZV3j3+ec+m/PQ9cTpBvqjFQmy2XVUWGn5MD+31oXHb6dVTxYzmAeaiUBYjkoNz66n3RGCg==",
"dependencies": {
"@remix-run/router": "1.13.1"
"@remix-run/router": "1.14.0"
},
"engines": {
"node": ">=14.0.0"
@@ -18290,12 +18448,12 @@
}
},
"node_modules/react-router-dom": {
"version": "6.20.1",
"resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.20.1.tgz",
"integrity": "sha512-npzfPWcxfQN35psS7rJgi/EW0Gx6EsNjfdJSAk73U/HqMEJZ2k/8puxfwHFgDQhBGmS3+sjnGbMdMSV45axPQw==",
"version": "6.21.0",
"resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.21.0.tgz",
"integrity": "sha512-1dUdVj3cwc1npzJaf23gulB562ESNvxf7E4x8upNJycqyUm5BRRZ6dd3LrlzhtLaMrwOCO8R0zoiYxdaJx4LlQ==",
"dependencies": {
"@remix-run/router": "1.13.1",
"react-router": "6.20.1"
"@remix-run/router": "1.14.0",
"react-router": "6.21.0"
},
"engines": {
"node": ">=14.0.0"

View File

@@ -11,14 +11,16 @@
"@craco/craco": "^7.1.0",
"@fingerprintjs/fingerprintjs": "^4.2.1",
"@jsreport/browser-client": "^3.1.0",
"@sentry/react": "^7.86.0",
"@sentry/tracing": "^7.86.0",
"@sentry/react": "^7.87.0",
"@sentry/tracing": "^7.87.0",
"@splitsoftware/splitio-react": "^1.10.2",
"@tanem/react-nprogress": "^5.0.51",
"antd": "^5.12.2",
"apollo-link-logger": "^2.0.1",
"axios": "^1.3.6",
"craco-less": "^3.0.1",
"dayjs": "^1.11.10",
"dayjs-business-days2": "^1.2.2",
"dinero.js": "^1.9.1",
"dotenv": "^16.3.1",
"enquire-js": "^0.2.1",
@@ -33,8 +35,6 @@
"libphonenumber-js": "^1.10.51",
"logrocket": "^7.0.0",
"markerjs2": "^2.31.4",
"moment-business-days": "^1.2.0",
"moment-timezone": "^0.5.43",
"normalize-url": "^8.0.0",
"phone": "^3.1.41",
"preval.macro": "^5.0.0",
@@ -57,7 +57,7 @@
"react-number-format": "^5.1.4",
"react-redux": "^9.0.4",
"react-resizable": "^3.0.5",
"react-router-dom": "^6.20.1",
"react-router-dom": "^6.21.0",
"react-scripts": "^5.0.1",
"react-sticky": "^6.0.3",
"react-sublime-video": "^0.2.5",
@@ -122,7 +122,6 @@
"react-error-overlay": "6.0.9"
},
"devDependencies": {
"@ant-design/moment-webpack-plugin": "^0.0.4",
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@sentry/webpack-plugin": "^2.10.2",
"@testing-library/cypress": "^10.0.1",

View File

@@ -2,14 +2,15 @@ import { ApolloProvider } from "@apollo/client";
import { SplitFactory, SplitSdk } from "@splitsoftware/splitio-react";
import { ConfigProvider } from "antd";
import enLocale from "antd/es/locale/en_US";
import moment from "moment";
import dayjs from "../utils/day";
import 'dayjs/locale/en';
import React from "react";
import { useTranslation } from "react-i18next";
import GlobalLoadingBar from "../components/global-loading-bar/global-loading-bar.component";
import client from "../utils/GraphQLClient";
import App from "./App";
moment.locale("en-US");
dayjs.locale("en");
export const factory = SplitSdk({
core: {

View File

@@ -1,6 +1,6 @@
import {useMutation, useQuery} from "@apollo/client";
import {Button, Form, Popconfirm, Space} from "antd";
import moment from "moment";
import dayjs from "../../utils/day";
import queryString from "query-string";
import React, {useState} from "react";
import {useTranslation} from "react-i18next";
@@ -240,7 +240,7 @@ const transformData = (data) => {
},
};
}),
date: data.bills_by_pk ? moment(data.bills_by_pk.date) : null,
date: data.bills_by_pk ? dayjs(data.bills_by_pk.date) : null,
}
: {};
};

View File

@@ -12,7 +12,7 @@ import {
Switch,
Upload,
} from "antd";
import moment from "moment";
import dayjs from "../../utils/day";
import React, { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import { MdOpenInNew } from "react-icons/md";
@@ -274,17 +274,17 @@ export function BillFormComponent({
bodyshop.accountingconfig.ClosingPeriod
) {
if (
moment(value)
dayjs(value)
.startOf("day")
.isSameOrAfter(
moment(
dayjs(
bodyshop.accountingconfig.ClosingPeriod[0]
).startOf("day")
) &&
moment(value)
dayjs(value)
.startOf("day")
.isSameOrBefore(
moment(
dayjs(
bodyshop.accountingconfig.ClosingPeriod[1]
).endOf("day")
)

View File

@@ -2,7 +2,7 @@ import { FileAddFilled } from "@ant-design/icons";
import { useMutation } from "@apollo/client";
import { Button, notification, Tooltip } from "antd";
import { t } from "i18next";
import moment from "moment";
import dayjs from "./../../utils/day";
import React, { useState } from "react";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
@@ -49,7 +49,7 @@ export function BilllineAddInventory({
jobid: jobid,
isinhouse: true,
is_credit_memo: true,
date: moment().format("YYYY-MM-DD"),
date: dayjs().format("YYYY-MM-DD"),
federal_tax_rate: bodyshop.bill_tax_rates.federal_tax_rate,
state_tax_rate: bodyshop.bill_tax_rates.state_tax_rate,
local_tax_rate: bodyshop.bill_tax_rates.local_tax_rate,
@@ -91,7 +91,7 @@ export function BilllineAddInventory({
pol: {
returnfrombill: billid,
vendorid: bodyshop.inhousevendorid,
deliver_by: moment().format("YYYY-MM-DD"),
deliver_by: dayjs().format("YYYY-MM-DD"),
parts_order_lines: {
data: [
{

View File

@@ -13,7 +13,7 @@ import {
notification,
} 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";
@@ -117,7 +117,7 @@ const CardPaymentModalComponent = ({
payer: t("payments.labels.customer"),
type: values.paymentResponse.cardbrand,
jobid: payment.jobid,
date: moment(Date.now()),
date: dayjs(Date.now()),
payment_responses: {
data: [
{

View File

@@ -1,7 +1,7 @@
import Icon from "@ant-design/icons";
import { Tooltip } from "antd";
import i18n from "i18next";
import moment from "moment";
import dayjs from "../../utils/day";
import React, { useEffect, useRef } from "react";
import { MdDone, MdDoneAll } from "react-icons/md";
import {
@@ -52,7 +52,7 @@ export default function ChatMessageListComponent({ messages }) {
<div style={{ fontSize: 10 }}>
{i18n.t("messaging.labels.sentby", {
by: messages[index].userid,
time: moment(messages[index].created_at).format(
time: dayjs(messages[index].created_at).format(
"MM/DD/YYYY @ hh:mm a"
),
})}

View File

@@ -1,5 +1,5 @@
import { useQuery } from "@apollo/client";
import moment from "moment";
import dayjs from "../../utils/day";
import React from "react";
import { QUERY_AVAILABLE_CC } from "../../graphql/courtesy-car.queries";
import AlertComponent from "../alert/alert.component";
@@ -7,7 +7,7 @@ import ContractCarsComponent from "./contract-cars.component";
export default function ContractCarsContainer({ selectedCarState, form }) {
const { loading, error, data } = useQuery(QUERY_AVAILABLE_CC, {
variables: { today: moment().format("YYYY-MM-DD") },
variables: { today: dayjs().format("YYYY-MM-DD") },
fetchPolicy: "network-only",
nextFetchPolicy: "network-only",
});

View File

@@ -10,7 +10,7 @@ import {
Space,
} 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";
@@ -46,8 +46,8 @@ export function ContractConvertToRo({
const handleFinish = async (values) => {
setLoading(true);
const contractLength = moment(contract.actualreturn).diff(
moment(contract.start),
const contractLength = dayjs(contract.actualreturn).diff(
dayjs(contract.start),
"days"
);
const billingLines = [];

View File

@@ -1,6 +1,6 @@
import { WarningFilled } from "@ant-design/icons";
import { Form, Input, InputNumber, Space } from "antd";
import moment from "moment";
import dayjs from "../../utils/day";
import React from "react";
import { useTranslation } from "react-i18next";
import { DateFormatter } from "../../utils/DateFormatter";
@@ -96,8 +96,8 @@ export default function ContractFormComponent({
const dueForService =
selectedCar &&
selectedCar.nextservicedate &&
moment(selectedCar.nextservicedate).isBefore(
moment(form.getFieldValue("scheduledreturn"))
dayjs(selectedCar.nextservicedate).isBefore(
dayjs(form.getFieldValue("scheduledreturn"))
);
if (mileageOver || dueForService)
@@ -190,9 +190,9 @@ export default function ContractFormComponent({
}
>
{() => {
const dlExpiresBeforeReturn = moment(
const dlExpiresBeforeReturn = dayjs(
form.getFieldValue("driver_dlexpiry")
).isBefore(moment(form.getFieldValue("scheduledreturn")));
).isBefore(dayjs(form.getFieldValue("scheduledreturn")));
return (
<div>

View File

@@ -1,5 +1,5 @@
import { Button, Input, Modal, Typography } from "antd";
import moment from "moment";
import dayjs from "../../utils/day";
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import aamva from "../../utils/aamva";
@@ -26,8 +26,8 @@ export default function ContractLicenseDecodeButton({ form }) {
const values = {
driver_dlnumber: decodedBarcode.dl,
driver_dlexpiry: moment(
`20${decodedBarcode.expiration_date}${moment(
driver_dlexpiry: dayjs(
`20${decodedBarcode.expiration_date}${dayjs(
decodedBarcode.birthday
).format("DD")}`
),
@@ -38,7 +38,7 @@ export default function ContractLicenseDecodeButton({ form }) {
driver_city: decodedBarcode.city,
driver_state: decodedBarcode.state,
driver_zip: decodedBarcode.postal_code,
driver_dob: moment(decodedBarcode.birthday),
driver_dob: dayjs(decodedBarcode.birthday),
};
form.setFieldsValue(values);
@@ -94,14 +94,14 @@ export default function ContractLicenseDecodeButton({ form }) {
{decodedBarcode.address}
</DataLabel>
<DataLabel label={t("contracts.fields.driver_dlexpiry")}>
{moment(
`20${decodedBarcode.expiration_date}${moment(
{dayjs(
`20${decodedBarcode.expiration_date}${dayjs(
decodedBarcode.birthday
).format("DD")}`
).format("MM/DD/YYYY")}
</DataLabel>
<DataLabel label={t("contracts.fields.driver_dob")}>
{moment(decodedBarcode.birthday).format("MM/DD/YYYY")}
{dayjs(decodedBarcode.birthday).format("MM/DD/YYYY")}
</DataLabel>
<div>
<Typography.Title level={4}>

View File

@@ -9,7 +9,7 @@ import { DateTimeFormatter } from "../../utils/DateFormatter";
import { alphaSort } from "../../utils/sorters";
import ContractsFindModalContainer from "../contracts-find-modal/contracts-find-modal.container";
import moment from "moment";
import dayjs from "../../utils/day";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { selectBodyshop } from "../../redux/user/user.selectors";
@@ -152,8 +152,8 @@ export function ContractsList({
render: (text, record) =>
(record.actualreturn &&
record.start &&
`${moment(record.actualreturn)
.diff(moment(record.start), "days", true)
`${dayjs(record.actualreturn)
.diff(dayjs(record.start), "days", true)
.toFixed(1)} days`) ||
"",
},

View File

@@ -2,7 +2,7 @@ import { WarningFilled } from "@ant-design/icons";
import { useApolloClient } from "@apollo/client";
import { Button, Form, Input, InputNumber, Space } from "antd";
import {PageHeader} from "@ant-design/pro-layout";
import moment from "moment";
import dayjs from "../../utils/day";
import React from "react";
import { useTranslation } from "react-i18next";
import { CHECK_CC_FLEET_NUMBER } from "../../graphql/courtesy-car.queries";
@@ -259,7 +259,7 @@ export default function CourtesyCarCreateFormComponent({ form, saveLoading }) {
const nextservicedate = form.getFieldValue("nextservicedate");
const dueForService =
nextservicedate &&
moment(nextservicedate).endOf("day").isSameOrBefore(moment());
dayjs(nextservicedate).endOf("day").isSameOrBefore(dayjs());
if (dueForService)
return (
@@ -300,7 +300,7 @@ export default function CourtesyCarCreateFormComponent({ form, saveLoading }) {
const expires = form.getFieldValue("registrationexpires");
const dateover =
expires && moment(expires).endOf("day").isBefore(moment());
expires && dayjs(expires).endOf("day").isBefore(dayjs());
if (dateover)
return (
@@ -336,7 +336,7 @@ export default function CourtesyCarCreateFormComponent({ form, saveLoading }) {
const expires = form.getFieldValue("insuranceexpires");
const dateover =
expires && moment(expires).endOf("day").isBefore(moment());
expires && dayjs(expires).endOf("day").isBefore(dayjs());
if (dateover)
return (

View File

@@ -7,7 +7,7 @@ import { toggleModalVisible } from "../../redux/modals/modals.actions";
import { selectCourtesyCarReturn } from "../../redux/modals/modals.selectors";
import { selectBodyshop } from "../../redux/user/user.selectors";
import CourtesyCarReturnModalComponent from "./courtesy-car-return-modal.component";
import moment from "moment";
import dayjs from "../../utils/day";
import { RETURN_CONTRACT } from "../../graphql/cccontracts.queries";
import { useMutation } from "@apollo/client";
@@ -74,7 +74,7 @@ export function CCReturnModalContainer({
<Form
form={form}
onFinish={handleFinish}
initialValues={{ fuel: 100, actualreturn: moment(new Date()) }}
initialValues={{ fuel: 100, actualreturn: dayjs(new Date()) }}
>
<CourtesyCarReturnModalComponent />
</Form>

View File

@@ -9,7 +9,7 @@ import {
Table,
Tooltip,
} from "antd";
import moment from "moment";
import dayjs from "../../utils/day";
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import { Link } from "react-router-dom";
@@ -77,7 +77,7 @@ export default function CourtesyCarsList({ loading, courtesycars, refetch }) {
const mileageOver = nextservicekm <= mileage;
const dueForService =
nextservicedate && moment(nextservicedate).isBefore(moment());
nextservicedate && dayjs(nextservicedate).isBefore(dayjs());
return (
<Space>

View File

@@ -1,6 +1,6 @@
import { Card } from "antd";
import _ from "lodash";
import moment from "moment";
import dayjs from "../../../utils/day";
import React from "react";
import { useTranslation } from "react-i18next";
import {
@@ -27,7 +27,7 @@ export default function DashboardMonthlyEmployeeEfficiency({
return <DashboardRefreshRequired {...cardProps} />;
const ticketsByDate = _.groupBy(data.monthly_employee_efficiency, (item) =>
moment(item.date).format("YYYY-MM-DD")
dayjs(item.date).format("YYYY-MM-DD")
);
const listOfDays = Utils.ListOfDaysInCurrentMonth();
@@ -53,7 +53,7 @@ export default function DashboardMonthlyEmployeeEfficiency({
((dailyHrs.productive - dailyHrs.actual) / dailyHrs.actual + 1) * 100;
const theValue = {
date: moment(val).format("DD"),
date: dayjs(val).format("DD"),
// ...dailyHrs,
actual: dailyHrs.actual.toFixed(1),
productive: dailyHrs.productive.toFixed(1),
@@ -159,9 +159,9 @@ export default function DashboardMonthlyEmployeeEfficiency({
}
export const DashboardMonthlyEmployeeEfficiencyGql = `
monthly_employee_efficiency: timetickets(where: {_and: [{date: {_gte: "${moment()
monthly_employee_efficiency: timetickets(where: {_and: [{date: {_gte: "${dayjs()
.startOf("month")
.format("YYYY-MM-DD")}"}},{date: {_lte: "${moment()
.format("YYYY-MM-DD")}"}},{date: {_lte: "${dayjs()
.endOf("month")
.format("YYYY-MM-DD")}"}} ]}) {
actualhrs

View File

@@ -1,5 +1,5 @@
import { Card } from "antd";
import moment from "moment";
import dayjs from "../../../utils/day";
import React from "react";
import { useTranslation } from "react-i18next";
import _ from "lodash";
@@ -24,7 +24,7 @@ export default function DashboardMonthlyRevenueGraph({ data, ...cardProps }) {
if (!data.monthly_sales) return <DashboardRefreshRequired {...cardProps} />;
const jobsByDate = _.groupBy(data.monthly_sales, (item) =>
moment(item.date_invoiced).format("YYYY-MM-DD")
dayjs(item.date_invoiced).format("YYYY-MM-DD")
);
const listOfDays = Utils.ListOfDaysInCurrentMonth();
@@ -43,7 +43,7 @@ export default function DashboardMonthlyRevenueGraph({ data, ...cardProps }) {
}
const theValue = {
date: moment(val).format("DD"),
date: dayjs(val).format("DD"),
dailySales: dailySales.getAmount() / 100,
accSales:
acc.length > 0

View File

@@ -1,6 +1,6 @@
import { Card, Statistic } from "antd";
import Dinero from "dinero.js";
import moment from "moment";
import dayjs from "../../../utils/day";
import React from "react";
import { useTranslation } from "react-i18next";
import DashboardRefreshRequired from "../refresh-required.component";
@@ -36,10 +36,10 @@ export const DashboardProjectedMonthlySalesGql = `
_or: [
{_and: [
{date_invoiced:{_is_null: false }},
{date_invoiced: {_gte: "${moment()
{date_invoiced: {_gte: "${dayjs()
.startOf("month")
.startOf("day")
.toISOString()}"}}, {date_invoiced: {_lte: "${moment()
.toISOString()}"}}, {date_invoiced: {_lte: "${dayjs()
.endOf("month")
.endOf("day")
.toISOString()}"}}]},
@@ -47,10 +47,10 @@ export const DashboardProjectedMonthlySalesGql = `
_and:[
{date_invoiced:{_is_null: true }},
{actual_completion: {_gte: "${moment()
{actual_completion: {_gte: "${dayjs()
.startOf("month")
.startOf("day")
.toISOString()}"}}, {actual_completion: {_lte: "${moment()
.toISOString()}"}}, {actual_completion: {_lte: "${dayjs()
.endOf("month")
.endOf("day")
.toISOString()}"}}
@@ -61,10 +61,10 @@ _and:[
{_and: [
{date_invoiced: {_is_null: true}},
{actual_completion: {_is_null: true}}
{scheduled_completion: {_gte: "${moment()
{scheduled_completion: {_gte: "${dayjs()
.startOf("month")
.startOf("day")
.toISOString()}"}}, {scheduled_completion: {_lte: "${moment()
.toISOString()}"}}, {scheduled_completion: {_lte: "${dayjs()
.endOf("month")
.endOf("day")
.toISOString()}"}}

View File

@@ -4,7 +4,7 @@ import {
PauseCircleOutlined,
} from "@ant-design/icons";
import { Card, Space, Table, Tooltip } from "antd";
import moment from "moment";
import dayjs from "../../../utils/day";
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import { Link } from "react-router-dom";
@@ -49,14 +49,14 @@ export default function DashboardScheduledInToday({ data, ...cardProps }) {
v_vin: item.job.v_vin,
vehicleid: item.job.vehicleid,
note: item.note,
start: moment(item.start).format("hh:mm a"),
start: dayjs(item.start).format("hh:mm a"),
title: item.title,
};
appt.push(i);
}
});
appt.sort(function (a, b) {
return new moment(a.start) - new moment(b.start);
return new dayjs(a.start) - new dayjs(b.start);
});
const columns = [
@@ -189,7 +189,7 @@ export default function DashboardScheduledInToday({ data, ...cardProps }) {
return (
<Card
title={t("dashboard.titles.scheduledintoday", {
date: moment().startOf("day").format("MM/DD/YYYY"),
date: dayjs().startOf("day").format("MM/DD/YYYY"),
})}
{...cardProps}
>
@@ -209,9 +209,9 @@ export default function DashboardScheduledInToday({ data, ...cardProps }) {
}
export const DashboardScheduledInTodayGql = `
scheduled_in_today: appointments(where: {start: {_gte: "${moment()
scheduled_in_today: appointments(where: {start: {_gte: "${dayjs()
.startOf("day")
.toISOString()}", _lte: "${moment()
.toISOString()}", _lte: "${dayjs()
.endOf("day")
.toISOString()}"}, canceled: {_eq: false}, block: {_neq: true}}) {
canceled

View File

@@ -4,7 +4,7 @@ import {
PauseCircleOutlined,
} from "@ant-design/icons";
import { Card, Space, Table, Tooltip } from "antd";
import moment from "moment";
import dayjs from "../../../utils/day";
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import { Link } from "react-router-dom";
@@ -23,7 +23,7 @@ export default function DashboardScheduledOutToday({ data, ...cardProps }) {
return <DashboardRefreshRequired {...cardProps} />;
data.scheduled_out_today.forEach((item) => {
item.scheduled_completion= moment(item.scheduled_completion).format("hh:mm a")
item.scheduled_completion= dayjs(item.scheduled_completion).format("hh:mm a")
});
data.scheduled_out_today.sort(function (a, b) {
return new Date(a.scheduled_completion) - new Date(b.scheduled_completion);
@@ -159,7 +159,7 @@ export default function DashboardScheduledOutToday({ data, ...cardProps }) {
return (
<Card
title={t("dashboard.titles.scheduledouttoday", {
date: moment().startOf("day").format("MM/DD/YYYY"),
date: dayjs().startOf("day").format("MM/DD/YYYY"),
})}
{...cardProps}
>
@@ -183,8 +183,8 @@ export const DashboardScheduledOutTodayGql = `
date_invoiced: {_is_null: true},
ro_number: {_is_null: false},
voided: {_eq: false},
scheduled_completion: {_gte: "${moment().startOf("day").toISOString()}",
_lte: "${moment().endOf("day").toISOString()}"}}) {
scheduled_completion: {_gte: "${dayjs().startOf("day").toISOString()}",
_lte: "${dayjs().endOf("day").toISOString()}"}}) {
alt_transport
clm_no
jobid: id

View File

@@ -4,7 +4,7 @@ import { Button, Dropdown, Menu, Space, notification } from "antd";
import {PageHeader} from "@ant-design/pro-layout";
import i18next from "i18next";
import _ from "lodash";
import moment from "moment";
import dayjs from "../../utils/day";
import React, { useState } from "react";
import { Responsive, WidthProvider } from "react-grid-layout";
import { useTranslation } from "react-i18next";
@@ -277,7 +277,7 @@ const componentList = {
},
ScheduleInToday: {
label: i18next.t("dashboard.titles.scheduledintoday", {
date: moment().startOf("day").format("MM/DD/YYYY"),
date: dayjs().startOf("day").format("MM/DD/YYYY"),
}),
component: DashboardScheduledInToday,
gqlFragment: DashboardScheduledInTodayGql,
@@ -288,7 +288,7 @@ const componentList = {
},
ScheduleOutToday: {
label: i18next.t("dashboard.titles.scheduledouttoday", {
date: moment().startOf("day").format("MM/DD/YYYY"),
date: dayjs().startOf("day").format("MM/DD/YYYY"),
}),
component: DashboardScheduledOutToday,
gqlFragment: DashboardScheduledOutTodayGql,
@@ -311,10 +311,10 @@ const createDashboardQuery = (state) => {
${componentBasedAdditions || ""}
monthly_sales: jobs(where: {_and: [
{ voided: {_eq: false}},
{date_invoiced: {_gte: "${moment()
{date_invoiced: {_gte: "${dayjs()
.startOf("month")
.startOf("day")
.toISOString()}"}}, {date_invoiced: {_lte: "${moment()
.toISOString()}"}}, {date_invoiced: {_lte: "${dayjs()
.endOf("month")
.endOf("day")
.toISOString()}"}}]}) {

View File

@@ -1,5 +1,5 @@
import { Divider, Space, Tag, Timeline } from "antd";
import moment from "moment";
import dayjs from "../../utils/day";
import React from "react";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
@@ -29,7 +29,7 @@ export function DmsLogEvents({ socket, logs, bodyshop }) {
<Timeline.Item key={idx} color={LogLevelHierarchy(log.level)}>
<Space wrap align="start" style={{}}>
<Tag color={LogLevelHierarchy(log.level)}>{log.level}</Tag>
<span>{moment(log.timestamp).format("MM/DD/YYYY HH:mm:ss")}</span>
<span>{dayjs(log.timestamp).format("MM/DD/YYYY HH:mm:ss")}</span>
<Divider type="vertical" />
<span>{log.message}</span>
</Space>

View File

@@ -15,7 +15,7 @@ import {
Typography,
} from "antd";
import Dinero from "dinero.js";
import moment from "moment";
import dayjs from "../../utils/day";
import React from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
@@ -101,7 +101,7 @@ export function DmsPostForm({ bodyshop, socket, job, logsRef }) {
})
: ""
}`.substr(0, 239),
inservicedate: moment("2019-01-01"),
inservicedate: dayjs("2019-01-01"),
}}
>
<LayoutFormRow grow>

View File

@@ -7,7 +7,7 @@ import { selectCurrentUser } from "../../redux/user/user.selectors";
import { GenerateDocument } from "../../utils/RenderTemplate";
import DateTimePicker from "../form-date-time-picker/form-date-time-picker.component";
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
import moment from "moment";
import dayjs from "../../utils/day";
const mapStateToProps = createStructuredSelector({
currentUser: selectCurrentUser,
@@ -27,16 +27,16 @@ export function EmailTestComponent({ currentUser, setEmailOptions }) {
variables: {
...(values.start
? {
start: moment(values.start).startOf("day").format("YYYY-MM-DD"),
start: dayjs(values.start).startOf("day").format("YYYY-MM-DD"),
}
: {}),
...(values.end
? { end: moment(values.end).endOf("day").format("YYYY-MM-DD") }
? { end: dayjs(values.end).endOf("day").format("YYYY-MM-DD") }
: {}),
...(values.start
? { starttz: moment(values.start).startOf("day") }
? { starttz: dayjs(values.start).startOf("day") }
: {}),
...(values.end ? { endtz: moment(values.end).endOf("day") } : {}),
...(values.end ? { endtz: dayjs(values.end).endOf("day") } : {}),
...(values.id ? { id: values.id } : {}),
},

View File

@@ -1,4 +1,4 @@
import moment from "moment";
import dayjs from "../../utils/day";
import React from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
@@ -34,7 +34,7 @@ function FeatureWrapper({
export function HasFeatureAccess({ featureName, bodyshop }) {
return (
bodyshop.features.allAccess ||
moment(bodyshop.features[featureName]).isAfter(moment())
dayjs(bodyshop.features[featureName]).isAfter(dayjs())
);
}

View File

@@ -1,31 +1,29 @@
import { DatePicker } from "antd";
import moment from "moment";
import dayjs from "../../utils/day";
import React, { useRef } from "react";
//To be used as a form element only.
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { selectBodyshop } from "../../redux/user/user.selectors";
const mapStateToProps = createStructuredSelector({
//currentUser: selectCurrentUser
bodyshop: selectBodyshop,
});
const mapDispatchToProps = (dispatch) => ({
//setUserLanguage: language => dispatch(setUserLanguage(language))
});
const mapDispatchToProps = (dispatch) => ({});
export default connect(mapStateToProps, mapDispatchToProps)(FormDatePicker);
const dateFormat = "MM/DD/YYYY";
// TODO, this is causing a dirty change when it should not (click the picker, click off the picker)
export function FormDatePicker({
bodyshop,
value,
onChange,
onBlur,
onlyFuture,
isDateOnly = true,
...restProps
}) {
bodyshop,
value,
onChange,
onBlur,
onlyFuture,
isDateOnly = true,
...restProps
}) {
const ref = useRef();
const handleChange = (newDate) => {
@@ -37,8 +35,7 @@ export function FormDatePicker({
const handleKeyDown = (e) => {
if (e.key.toLowerCase() === "t") {
if (onChange) {
onChange(isDateOnly ? moment().format("YYYY-MM-DD") : moment());
// if (ref.current && ref.current.blur) ref.current.blur();
onChange(isDateOnly ? dayjs().format("YYYY-MM-DD") : dayjs());
}
} else if (e.key.toLowerCase() === "enter") {
if (ref.current && ref.current.blur) ref.current.blur();
@@ -49,14 +46,23 @@ export function FormDatePicker({
const v = e.target.value;
if (!v) return;
const _a = moment(
v,
["MMDDYY", "MMDDYYYY", "MMDD", "MM/DD/YY"],
"en",
false
const _a = dayjs(
v,
["MMDDYY", "MMDDYYYY", "MMDD", "MM/DD/YY"],
"en",
false
);
if (_a.isValid() && value && value.isValid && value.isValid()) {
if (
_a.isValid()
&& value
&& value.isValid
&& value.isValid()
&& typeof value.hours === 'function'
&& typeof value.minutes === 'function'
&& typeof value.seconds === 'function'
&& typeof value.milliseconds === 'function'
) {
_a.set({
hours: value.hours(),
minutes: value.minutes(),
@@ -67,10 +73,10 @@ export function FormDatePicker({
if (_a.isValid() && onChange) {
if (onlyFuture) {
if (moment().subtract(1, "day").isBefore(_a)) {
if (dayjs().subtract(1, "day").isBefore(_a)) {
onChange(isDateOnly ? _a.format("YYYY-MM-DD") : _a);
} else {
onChange(isDateOnly ? moment().format("YYYY-MM-DD") : moment());
onChange(isDateOnly ? dayjs().format("YYYY-MM-DD") : dayjs());
}
} else {
onChange(isDateOnly ? _a.format("YYYY-MM-DD") : _a);
@@ -79,20 +85,20 @@ export function FormDatePicker({
};
return (
<div onKeyDown={handleKeyDown}>
<DatePicker
ref={ref}
value={value ? moment(value) : null}
onChange={handleChange}
format={dateFormat}
onBlur={onBlur || handleBlur}
showToday={false}
disabledTime
{...(onlyFuture && {
disabledDate: (d) => moment().subtract(1, "day").isAfter(d),
})}
{...restProps}
/>
</div>
<div onKeyDown={handleKeyDown}>
<DatePicker
ref={ref}
value={value ? dayjs(value) : null}
onChange={handleChange}
format={dateFormat}
onBlur={onBlur || handleBlur}
showToday={false}
disabledTime
{...(onlyFuture && {
disabledDate: (d) => dayjs().subtract(1, "day").isAfter(d),
})}
{...restProps}
/>
</div>
);
}
}

View File

@@ -2,7 +2,7 @@ import React, { forwardRef } from "react";
//import DatePicker from "react-datepicker";
//import "react-datepicker/src/stylesheets/datepicker.scss";
import { TimePicker } from "antd";
import moment from "moment";
import dayjs from "../../utils/day";
import FormDatePicker from "../form-date-picker/form-date-picker.component";
//To be used as a form element only.
@@ -21,7 +21,7 @@ const DateTimePicker = (
<FormDatePicker
{...restProps}
{...(onlyFuture && {
disabledDate: (d) => moment().subtract(1, "day").isAfter(d),
disabledDate: (d) => dayjs().subtract(1, "day").isAfter(d),
})}
value={value}
onBlur={onBlur}
@@ -31,9 +31,9 @@ const DateTimePicker = (
/>
<TimePicker
value={value ? moment(value) : null}
value={value ? dayjs(value) : null}
{...(onlyFuture && {
disabledDate: (d) => moment().isAfter(d),
disabledDate: (d) => dayjs().isAfter(d),
})}
onChange={onChange}
showSecond={false}

View File

@@ -4,7 +4,7 @@ import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { setModalContext } from "../../redux/modals/modals.actions";
import { selectBodyshop } from "../../redux/user/user.selectors";
import moment from "moment";
import dayjs from "../../utils/day";
import { useTranslation } from "react-i18next";
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop,
@@ -35,7 +35,7 @@ export function InventoryBillRo({
vendorid: bodyshop.inhousevendorid,
invoice_number: "ih",
isinhouse: true,
date: moment(),
date: dayjs(),
total: 0,
billlines: [{}],
// billlines: selectedLines.map((p) => {

View File

@@ -12,7 +12,7 @@ import {
Space,
} from "antd";
import parsePhoneNumber from "libphonenumber-js";
import moment from "moment";
import dayjs from "../../utils/day";
import queryString from "query-string";
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
@@ -218,8 +218,8 @@ export function ScheduleEventComponent({
setMessage(
t("appointments.labels.reminder", {
shopname: bodyshop.shopname,
date: moment(event.start).format("MM/DD/YYYY"),
time: moment(event.start).format("HH:mm a"),
date: dayjs(event.start).format("MM/DD/YYYY"),
time: dayjs(event.start).format("HH:mm a"),
})
);
setVisible(false);

View File

@@ -1,6 +1,6 @@
import { useMutation } from "@apollo/client";
import { Button, Card, Form, Input, notification, Switch } from "antd";
import moment from "moment-business-days";
import dayjs from "../../../../utils/day";
import queryString from "query-string";
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
@@ -87,7 +87,7 @@ export function JobChecklistForm({
bodyshop.intakechecklist &&
bodyshop.intakechecklist.next_contact_hours &&
bodyshop.intakechecklist.next_contact_hours > 0 && {
date_next_contact: moment().add(
date_next_contact: dayjs().add(
bodyshop.intakechecklist.next_contact_hours,
"hours"
),
@@ -218,26 +218,26 @@ export function JobChecklistForm({
scheduled_completion:
(job &&
job.scheduled_completion &&
moment(job.scheduled_completion)) ||
dayjs(job.scheduled_completion)) ||
(job &&
job.labhrs &&
job.larhrs &&
moment().businessAdd(
dayjs().businessDaysAdd(
(job.labhrs.aggregate.sum.mod_lb_hrs ||
0 + job.larhrs.aggregate.sum.mod_lb_hrs ||
0) / bodyshop.target_touchtime,
"days"
)),
scheduled_delivery:
job.scheduled_delivery && moment(job.scheduled_delivery),
job.scheduled_delivery && dayjs(job.scheduled_delivery),
production_vars: job.production_vars,
}),
...(type === "deliver" && {
removeFromProduction: true,
actual_completion:
job && job.actual_completion && moment(job.actual_completion),
job && job.actual_completion && dayjs(job.actual_completion),
actual_delivery:
job && job.actual_delivery && moment(job.actual_delivery),
job && job.actual_delivery && dayjs(job.actual_delivery),
}),
...formItems
.filter((fi) => fi.value)

View File

@@ -43,7 +43,7 @@ import _ from "lodash";
import JobCreateIOU from "../job-create-iou/job-create-iou.component";
import JobLinesExpander from "./job-lines-expander.component";
import { selectBodyshop } from "../../redux/user/user.selectors";
import moment from "moment";
import dayjs from "../../utils/day";
import JobLineConvertToLabor from "../job-line-convert-to-labor/job-line-convert-to-labor.component";
const mapStateToProps = createStructuredSelector({
@@ -466,7 +466,7 @@ export function JobLinesComponent({
vendorid: bodyshop.inhousevendorid,
invoice_number: "ih",
isinhouse: true,
date: new moment(),
date: new dayjs(),
total: 0,
billlines: selectedLines.map((p) => {
return {

View File

@@ -210,7 +210,7 @@ export function JobLineConvertToLabor({
setLoading(true);
form.setFieldsValue({
// date: new moment(),
// date: new dayjs(),
// bodyhrs: Math.round(v.bodyhrs * 10) / 10,
// painthrs: Math.round(v.painthrs * 10) / 10,
});

View File

@@ -9,7 +9,7 @@ import {
Popover,
Space,
} from "antd";
import moment from "moment";
import dayjs from "../../utils/day";
import React, { useState, useEffect } from "react";
import { useTranslation } from "react-i18next";
import { logImEXEvent } from "../../firebase/firebase.utils";
@@ -177,7 +177,7 @@ export default function ScoreboardAddButton({
return acc + job.lbr_adjustments[val];
}, 0);
form.setFieldsValue({
date: new moment(),
date: new dayjs(),
bodyhrs: Math.round(v.bodyhrs * 10) / 10,
painthrs: Math.round(v.painthrs * 10) / 10,
});

View File

@@ -1,6 +1,6 @@
import { useMutation } from "@apollo/client";
import { Button, 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 { UPDATE_JOB } from "../../graphql/jobs.queries";
@@ -53,7 +53,7 @@ export function JobsAdminDatesChange({ insertAuditTrail, job }) {
jobid: job.id,
operation: AuditTrailMapping.admin_jobfieldchange(
key,
changedAuditFields[key] instanceof moment
changedAuditFields[key] instanceof dayjs
? DateTimeFormat(changedAuditFields[key])
: changedAuditFields[key]
),
@@ -89,7 +89,7 @@ export function JobsAdminDatesChange({ insertAuditTrail, job }) {
initialValues={{
...job,
date_estimated: job.date_estimated
? moment(job.date_estimated)
? dayjs(job.date_estimated)
: null,
}}
>

View File

@@ -3,7 +3,7 @@ import { Button, notification } from "antd";
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import moment from "moment";
import dayjs from "../../utils/day";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { INSERT_EXPORT_LOG } from "../../graphql/accounting.queries";
@@ -108,7 +108,7 @@ export function JobAdminMarkReexport({
const handleMarkExported = async () => {
setLoading(true);
const result = await markJobExported({
variables: { jobId: job.id, date_exported: moment() },
variables: { jobId: job.id, date_exported: dayjs() },
});
await insertExportLog({

View File

@@ -63,8 +63,8 @@ mutation UNVOID_JOB($jobId: uuid!) {
// created_by: currentUser.email,
// audit: true,
// text: t("jobs.labels.voidnote", {
// date: moment().format("MM/DD/yyy"),
// time: moment().format("hh:mm a"),
// date: dayjs().format("MM/DD/yyy"),
// time: dayjs().format("hh:mm a"),
// }),
// },
// ],

View File

@@ -9,7 +9,7 @@ import { useTreatments } from "@splitsoftware/splitio-react";
import { Col, notification, Row } from "antd";
import Axios from "axios";
import Dinero from "dinero.js";
import moment from "moment";
import dayjs from "../../utils/day";
import queryString from "query-string";
import React, { useCallback, useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
@@ -137,7 +137,7 @@ export function JobsAvailableContainer({
clm_total: Dinero(newTotals.totals.total_repairs).toFormat("0.00"),
owner_owing: Dinero(newTotals.totals.custPayable.total).toFormat("0.00"),
job_totals: newTotals,
date_open: moment(),
date_open: dayjs(),
status: bodyshop.md_ro_statuses.default_imported,
notes: {
data: {

View File

@@ -10,7 +10,7 @@ import {
Select,
Space,
} from "antd";
import moment from "moment";
import dayjs from "../../utils/day";
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
@@ -110,7 +110,7 @@ export function JobsDetailHeaderAddEvent({ bodyshop, jobid, ...props }) {
async validator(rule, value) {
if (value) {
const { start } = form.getFieldsValue();
if (moment(start).isAfter(moment(value))) {
if (dayjs(start).isAfter(dayjs(value))) {
return Promise.reject(
t("employees.labels.endmustbeafterstart")
);

View File

@@ -2,7 +2,7 @@ import Axios from "axios";
import _ from "lodash";
import { logImEXEvent } from "../../firebase/firebase.utils";
import { INSERT_NEW_JOB, QUERY_JOB_FOR_DUPE } from "../../graphql/jobs.queries";
import moment from "moment";
import dayjs from "../../utils/day";
import i18n from "i18next";
export default async function DuplicateJob(
@@ -92,7 +92,7 @@ export async function CreateIouForJob(
converted: true,
status: status,
iouparent: jobId,
date_open: moment(),
date_open: dayjs(),
audit_trails: {
data: [
{

View File

@@ -1,6 +1,6 @@
import { useMutation, useQuery, useApolloClient } from "@apollo/client";
import { Form, Modal, 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";
@@ -108,7 +108,7 @@ export function PartsOrderModalContainer({
po: [
{
...values,
order_date: moment().format("YYYY-MM-DD"),
order_date: dayjs().format("YYYY-MM-DD"),
orderedby: currentUser.email,
jobid: jobId,
user_email: currentUser.email,
@@ -185,7 +185,7 @@ export function PartsOrderModalContainer({
vendorid: bodyshop.inhousevendorid,
invoice_number: "ih",
isinhouse: true,
date: new moment(),
date: new dayjs(),
total: 0,
billlines: values.parts_order_lines.data.map((p) => {
return {
@@ -318,7 +318,7 @@ export function PartsOrderModalContainer({
const initialValues = {
jobid: jobId,
return: isReturn,
deliver_by: isReturn ? moment(new Date()) : null,
deliver_by: isReturn ? dayjs(new Date()) : null,
vendorid: vendorId,
returnfrombill: returnFromBill,

View File

@@ -8,7 +8,7 @@ import {
notification,
} 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 {
@@ -64,7 +64,7 @@ const PaymentExpandedRowComponent = ({ record, bodyshop }) => {
payer: record.payer,
type: "Refund",
jobid: payment_response.jobid,
date: moment(Date.now()),
date: dayjs(Date.now()),
},
},
update(cache, { data }) {

View File

@@ -14,7 +14,7 @@ import ProductionAlert from "../production-list-columns/production-list-columns.
import ProductionListColumnProductionNote from "../production-list-columns/production-list-columns.productionnote.component";
import ProductionSubletsManageComponent from "../production-sublets-manage/production-sublets-manage.component";
import "./production-board-card.styles.scss";
import moment from "moment";
import dayjs from "../../utils/day";
import OwnerNameDisplay from "../owner-name-display/owner-name-display.component";
import JobPartsQueueCount from "../job-parts-queue-count/job-parts-queue-count.component";
@@ -72,11 +72,11 @@ export default function ProductionBoardCard(
const pastDueAlert =
!!card.scheduled_completion &&
((moment().isSameOrAfter(moment(card.scheduled_completion), "day") &&
((dayjs().isSameOrAfter(dayjs(card.scheduled_completion), "day") &&
"production-completion-past") ||
(moment()
(dayjs()
.add(1, "day")
.isSame(moment(card.scheduled_completion), "day") &&
.isSame(dayjs(card.scheduled_completion), "day") &&
"production-completion-soon"));
const totalHrs =

View File

@@ -1,7 +1,7 @@
import { PauseCircleOutlined, BranchesOutlined } from "@ant-design/icons";
import { Space, Tooltip } from "antd";
import i18n from "i18next";
import moment from "moment";
import dayjs from "../../utils/day";
import { Link } from "react-router-dom";
import CurrencyFormatter from "../../utils/CurrencyFormatter";
import { TimeFormatter } from "../../utils/DateFormatter";
@@ -176,7 +176,7 @@ const r = ({ technician, state, activeStatuses, bodyshop }) => {
style={{
color:
record.date_next_contact &&
moment(record.date_next_contact).isBefore(moment())
dayjs(record.date_next_contact).isBefore(dayjs())
? "red"
: "",
}}

View File

@@ -1,6 +1,6 @@
import { useMutation } from "@apollo/client";
import { Button, Card, Dropdown, TimePicker } from "antd";
import moment from "moment";
import dayjs from "../../utils/day";
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import { logImEXEvent } from "../../firebase/firebase.utils";
@@ -20,7 +20,7 @@ export default function ProductionListDate({
const handleChange = (date) => {
logImEXEvent("product_toggle_date", { field });
// if (date.isSame(record[field] && moment(record[field]))) {
// if (date.isSame(record[field] && dayjs(record[field]))) {
// return;
// }
@@ -50,9 +50,9 @@ export default function ProductionListDate({
if (pastIndicator) {
className =
!!record[field] &&
((moment().isSameOrAfter(moment(record[field]), "day") &&
((dayjs().isSameOrAfter(dayjs(record[field]), "day") &&
"production-completion-past") ||
(moment().add(1, "day").isSame(moment(record[field]), "day") &&
(dayjs().add(1, "day").isSame(dayjs(record[field]), "day") &&
"production-completion-soon"));
}
@@ -68,7 +68,7 @@ export default function ProductionListDate({
<Card style={{ padding: "1rem" }} onClick={(e) => e.stopPropagation()}>
<FormDatePicker
onClick={(e) => e.stopPropagation()}
value={(record[field] && moment(record[field])) || null}
value={(record[field] && dayjs(record[field])) || null}
onChange={handleChange}
format="MM/DD/YYYY"
isDateOnly={!time}
@@ -76,7 +76,7 @@ export default function ProductionListDate({
{time && (
<TimePicker
onClick={(e) => e.stopPropagation()}
value={(record[field] && moment(record[field])) || null}
value={(record[field] && dayjs(record[field])) || null}
onChange={handleChange}
minuteStep={15}
format="hh:mm a"

View File

@@ -1,6 +1,6 @@
import { useMutation } from "@apollo/client";
import { Button, Card, Dropdown, Form, Input, notification, Space } from "antd";
import moment from "moment";
import dayjs from "../../utils/day";
import React, { useState, useEffect } from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
@@ -84,7 +84,7 @@ export function ProductionLastContacted({ currentUser, record }) {
form.setFieldsValue({
note: null,
date_last_contacted:
record.date_last_contacted && moment(record.date_last_contacted),
record.date_last_contacted && dayjs(record.date_last_contacted),
});
}
}, [visible, form, record.date_last_contacted]);

View File

@@ -1,4 +1,4 @@
import moment from "moment";
import dayjs from "../../utils/day";
import React, { useMemo } from "react";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
@@ -21,8 +21,8 @@ export function ProductionlistColumnTouchTime({ bodyshop, job }) {
(job.larhrs.aggregate.sum.mod_lb_hrs || 0) +
(job.labhrs.aggregate.sum.mod_lb_hrs || 0);
const Difference_In_Days = moment().diff(
moment(job.actual_in),
const Difference_In_Days = dayjs().diff(
dayjs(job.actual_in),
"days",
true
);

View File

@@ -11,7 +11,7 @@ import {
Typography,
} from "antd";
import _ from "lodash";
import moment from "moment";
import dayjs from "../../utils/day";
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
@@ -77,13 +77,13 @@ export function ReportCenterModalComponent({ reportCenterModal }) {
name: values.key,
variables: {
...(start
? { start: moment(start).startOf("day").format("YYYY-MM-DD") }
? { start: dayjs(start).startOf("day").format("YYYY-MM-DD") }
: {}),
...(end
? { end: moment(end).endOf("day").format("YYYY-MM-DD") }
? { end: dayjs(end).endOf("day").format("YYYY-MM-DD") }
: {}),
...(start ? { starttz: moment(start).startOf("day") } : {}),
...(end ? { endtz: moment(end).endOf("day") } : {}),
...(start ? { starttz: dayjs(start).startOf("day") } : {}),
...(end ? { endtz: dayjs(end).endOf("day") } : {}),
...(id ? { id: id } : {}),
},

View File

@@ -1,6 +1,6 @@
import { useMutation } from "@apollo/client";
import { Dropdown, Menu, notification } from "antd";
import moment from "moment";
import dayjs from "../../utils/day";
import React from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
@@ -34,8 +34,8 @@ export function ScheduleBlockDay({
block: true,
isintake: false,
bodyshopid: bodyshop.id,
start: moment(date).startOf("day"),
end: moment(date).endOf("day"),
start: dayjs(date).startOf("day"),
end: dayjs(date).endOf("day"),
};
logImEXEvent("dashboard_change_layout");

View File

@@ -1,7 +1,8 @@
import Icon from "@ant-design/icons";
import { Popover } from "antd";
import _ from "lodash";
import moment from "moment";
import dayjs from "../../utils/day";
import React, { useMemo } from "react";
import { useTranslation } from "react-i18next";
import { MdFileDownload, MdFileUpload } from "react-icons/md";
@@ -43,7 +44,7 @@ export function ScheduleCalendarHeaderComponent({
(e) =>
!e.vacation &&
e.isintake &&
moment(date).isSame(moment(e.start), "day")
dayjs(date).isSame(dayjs(e.start), "day")
),
"job.alt_transport"
);
@@ -54,7 +55,7 @@ export function ScheduleCalendarHeaderComponent({
return (
events &&
events.filter(
(e) => moment(date).isSame(moment(e.start), "day") && e.block
(e) => dayjs(date).isSame(dayjs(e.start), "day") && e.block
)
);
}, [events, date]);
@@ -170,7 +171,7 @@ export function ScheduleCalendarHeaderComponent({
const isShopOpen = (date) => {
let day;
switch (moment(date).day()) {
switch (dayjs(date).day()) {
case 0:
day = "sunday";
break;

View File

@@ -1,28 +1,28 @@
import moment from "moment";
import dayjs from "../../utils/day";
export function getRange(dateParam, viewParam) {
let start, end;
let date = dateParam || new Date();
let view = viewParam || "week";
// if view is day: from moment(date).startOf('day') to moment(date).endOf('day');
// if view is day: from dayjs(date).startOf('day') to dayjs(date).endOf('day');
if (view === "day") {
start = moment(date).startOf("day");
end = moment(date).endOf("day");
start = dayjs(date).startOf("day");
end = dayjs(date).endOf("day");
}
// if view is week: from moment(date).startOf('isoWeek') to moment(date).endOf('isoWeek');
// if view is week: from dayjs(date).startOf('isoWeek') to dayjs(date).endOf('isoWeek');
else if (view === "week") {
start = moment(date).startOf("week");
end = moment(date).endOf("week");
start = dayjs(date).startOf("week");
end = dayjs(date).endOf("week");
}
//if view is month: from moment(date).startOf('month').subtract(7, 'days') to moment(date).endOf('month').add(7, 'days'); i do additional 7 days math because you can see adjacent weeks on month view (that is the way how i generate my recurrent events for the Big Calendar, but if you need only start-end of month - just remove that math);
//if view is month: from dayjs(date).startOf('month').subtract(7, 'days') to dayjs(date).endOf('month').add(7, 'days'); i do additional 7 days math because you can see adjacent weeks on month view (that is the way how i generate my recurrent events for the Big Calendar, but if you need only start-end of month - just remove that math);
else if (view === "month") {
start = moment(date).startOf("month").subtract(7, "days");
end = moment(date).endOf("month").add(7, "days");
start = dayjs(date).startOf("month").subtract(7, "days");
end = dayjs(date).endOf("month").add(7, "days");
}
// if view is agenda: from moment(date).startOf('day') to moment(date).endOf('day').add(1, 'month');
// if view is agenda: from dayjs(date).startOf('day') to dayjs(date).endOf('day').add(1, 'month');
else if (view === "agenda") {
start = moment(date).startOf("day");
end = moment(date).endOf("day").add(1, "month");
start = dayjs(date).startOf("day");
end = dayjs(date).endOf("day").add(1, "month");
}
return { start, end };

View File

@@ -1,7 +1,7 @@
import moment from "moment";
import dayjs from "../../utils/day";
import queryString from "query-string";
import React from "react";
import { Calendar, momentLocalizer } from "react-big-calendar";
import { Calendar, dayjsLocalizer } from "react-big-calendar";
import { connect } from "react-redux";
import { useNavigate, useLocation } from "react-router-dom";
import { createStructuredSelector } from "reselect";
@@ -19,7 +19,7 @@ const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop,
problemJobs: selectProblemJobs,
});
const localizer = momentLocalizer(moment);
const localizer = dayjsLocalizer(dayjs);
export function ScheduleCalendarWrapperComponent({
bodyshop,
problemJobs,
@@ -49,7 +49,7 @@ export function ScheduleCalendarWrapperComponent({
};
};
const selectedDate = new Date(date || moment(search.date) || Date.now());
const selectedDate = new Date(date || dayjs(search.date) || Date.now());
return (
<>

View File

@@ -10,7 +10,7 @@ import ScheduleCalendarComponent from "./schedule-calendar.component";
import { calculateScheduleLoad } from "../../redux/application/application.actions";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import moment from "moment";
import dayjs from "../../utils/day";
const mapStateToProps = createStructuredSelector({
//currentUser: selectCurrentUser
});
@@ -63,8 +63,8 @@ export function ScheduleCalendarContainer({ calculateScheduleLoad }) {
(e.employee.first_name && e.employee.first_name.substr(0, 1)) || ""
} ${e.employee.last_name || ""} OUT`,
color: "red",
start: moment(e.start).startOf("day").toDate(),
end: moment(e.end).startOf("day").toDate(),
start: dayjs(e.start).startOf("day").toDate(),
end: dayjs(e.end).startOf("day").toDate(),
allDay: true,
vacation: true,
};

View File

@@ -3,18 +3,18 @@ import ScheduleDayViewComponent from "./schedule-day-view.component";
import { useQuery } from "@apollo/client";
import { QUERY_APPOINTMENT_BY_DATE } from "../../graphql/appointments.queries";
import LoadingSkeleton from "../loading-skeleton/loading-skeleton.component";
import moment from "moment";
import dayjs from "../../utils/day";
import { useTranslation } from "react-i18next";
export default function ScheduleDayViewContainer({ day }) {
const { loading, error, data } = useQuery(QUERY_APPOINTMENT_BY_DATE, {
variables: {
start: moment(day).startOf("day"),
end: moment(day).endOf("day"),
startd: moment(day).startOf("day").format("YYYY-MM-DD"),
endd: moment(day).add(1, "day").format("YYYY-MM-DD"),
start: dayjs(day).startOf("day"),
end: dayjs(day).endOf("day"),
startd: dayjs(day).startOf("day").format("YYYY-MM-DD"),
endd: dayjs(day).add(1, "day").format("YYYY-MM-DD"),
},
skip: !moment(day).isValid(),
skip: !dayjs(day).isValid(),
fetchPolicy: "network-only",
nextFetchPolicy: "network-only",
});
@@ -43,8 +43,8 @@ export default function ScheduleDayViewContainer({ day }) {
(e.employee.first_name && e.employee.first_name.substr(0, 1)) || ""
} ${e.employee.last_name || ""} OUT`,
color: "red",
start: moment(e.start).startOf("day").toDate(),
end: moment(e.end).startOf("day").toDate(),
start: dayjs(e.start).startOf("day").toDate(),
end: dayjs(e.end).startOf("day").toDate(),
vacation: true,
};
}),

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,

View File

@@ -1,6 +1,6 @@
import { useMutation } from "@apollo/client";
import { Button, Card, Form, Input, Popover, Select, Space } 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";
@@ -111,7 +111,7 @@ export function ScheduleManualEvent({ bodyshop, event }) {
async validator(rule, value) {
if (value) {
const { start } = form.getFieldsValue();
if (moment(start).isAfter(moment(value))) {
if (dayjs(start).isAfter(dayjs(value))) {
return Promise.reject(
t("employees.labels.endmustbeafterstart")
);

View File

@@ -1,6 +1,6 @@
import { useApolloClient } from "@apollo/client";
import { Button } from "antd";
import moment from "moment";
import dayjs from "../../utils/day";
import React, { useState } from "react";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
@@ -27,7 +27,7 @@ export function ScheduleVerifyIntegrity({ currentUser }) {
data: { arrJobs, compJobs, prodJobs },
} = await client.query({
query: QUERY_SCHEDULE_LOAD_DATA,
variables: { start: moment(), end: moment().add(180, "days") },
variables: { start: dayjs(), end: dayjs().add(180, "days") },
});
//check that the leaving jobs are either in the arriving list, or in production.

View File

@@ -1,7 +1,7 @@
import { Card } from "antd";
import Dinero from "dinero.js";
import _ from "lodash";
import moment from "moment";
import dayjs from "../../utils/day";
import React from "react";
import { connect } from "react-redux";
import {
@@ -61,7 +61,7 @@ export function ScoreboardChart({ sbEntriesByDate, bodyshop }) {
}
const theValue = {
date: moment(val).format("D ddd"),
date: dayjs(val).format("D ddd"),
paintHrs: _.round(dayhrs.painthrs, 1),
bodyHrs: _.round(dayhrs.bodyhrs, 1),
accTargetHrs: _.round(

View File

@@ -1,5 +1,5 @@
import { Card, Divider, Statistic } from "antd";
import moment from "moment";
import dayjs from "../../utils/day";
import React from "react";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
@@ -27,7 +27,7 @@ export function ScoreboardDayStats({ bodyshop, date, entries }) {
return (
<Card
title={moment(date).format("D - ddd")}
title={dayjs(date).format("D - ddd")}
className="ant-card-grid-hoverable"
style={{ height: "100%" }}
>

View File

@@ -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 (

View File

@@ -2,7 +2,7 @@ import React from "react";
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 ScoreboardDayStat from "../scoreboard-day-stats/scoreboard-day-stats.component";
import { Row, Col } from "antd";
import LoadingSkeleton from "../loading-skeleton/loading-skeleton.component";
@@ -15,11 +15,12 @@ const mapDispatchToProps = (dispatch) => ({
});
export function ScoreboardLastDays({ bodyshop, sbEntriesByDate }) {
const { lastNumberWorkingDays } = bodyshop.scoreboard_target;
const ArrayOfDate = [];
for (var i = lastNumberWorkingDays - 1; i >= 0; i--) {
ArrayOfDate.push(moment().businessSubtract(i, "day").format("yyyy-MM-DD"));
ArrayOfDate.push(dayjs().businessDaysSubtract(i, "day").format("yyyy-MM-DD"));
}
return (

View File

@@ -1,7 +1,7 @@
import { CalendarOutlined } from "@ant-design/icons";
import { Card, Col, Divider, Row, Statistic } from "antd";
import _ from "lodash";
import moment from "moment";
import dayjs from "../../utils/day";
import React, { useMemo } from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
@@ -35,7 +35,7 @@ export function ScoreboardTargetsTable({ bodyshop, scoreBoardlist }) {
toDatePaint: 0,
};
const today = moment();
const today = dayjs();
if (dateHash[today.format("YYYY-MM-DD")]) {
dateHash[today.format("YYYY-MM-DD")].forEach((d) => {
ret.todayBody = ret.todayBody + d.bodyhrs;
@@ -43,7 +43,7 @@ export function ScoreboardTargetsTable({ bodyshop, scoreBoardlist }) {
});
}
let StartOfWeek = moment().startOf("week");
let StartOfWeek = dayjs().startOf("week");
while (StartOfWeek.isSameOrBefore(today)) {
if (dateHash[StartOfWeek.format("YYYY-MM-DD")]) {
dateHash[StartOfWeek.format("YYYY-MM-DD")].forEach((d) => {
@@ -54,7 +54,7 @@ export function ScoreboardTargetsTable({ bodyshop, scoreBoardlist }) {
StartOfWeek = StartOfWeek.add(1, "day");
}
let startOfMonth = moment().startOf("month");
let startOfMonth = dayjs().startOf("month");
while (startOfMonth.isSameOrBefore(today)) {
if (dateHash[startOfMonth.format("YYYY-MM-DD")]) {
dateHash[startOfMonth.format("YYYY-MM-DD")].forEach((d) => {

View File

@@ -1,31 +1,31 @@
import moment from "moment-business-days";
import dayjs from "../../utils/day";
// moment.updateLocale("ca", {
// dayjs.updateLocale("ca", {
// workingWeekdays: [1, 2, 3, 4, 5, 6],
// });
export const CalculateWorkingDaysThisMonth = () => {
return moment().endOf("month").businessDaysIntoMonth();
return dayjs().endOf("month").businessDaysInMonth();
};
export const CalculateWorkingDaysInPeriod = (start, end) => {
return moment(start).businessDiff(moment(end));
return dayjs(start).businessDiff(dayjs(end));
};
export const CalculateWorkingDaysAsOfToday = () => {
return moment().businessDaysIntoMonth();
return dayjs().businessDaysInMonth();
};
export const CalculateWorkingDaysLastMonth = () => {
return moment().subtract(1, "month").endOf("month").businessDaysIntoMonth();
return dayjs().subtract(1, "month").endOf("month").businessDaysInMonth();
};
export const WeeklyTargetHrs = (dailyTargetHrs, bodyshop) => {
return (
dailyTargetHrs *
CalculateWorkingDaysInPeriod(
moment().startOf("week"),
moment().endOf("week")
dayjs().startOf("week"),
dayjs().endOf("week")
)
);
};
@@ -53,20 +53,22 @@ export const AsOfTodayTargetHrs = (dailyTargetHrs, bodyshop) => {
export const AsOfDateTargetHours = (dailyTargetHours, date) => {
return (
dailyTargetHours * moment().startOf("month").businessDiff(moment(date))
dailyTargetHours * dayjs().startOf("month").businessDiff(dayjs(date))
);
};
export const ListOfBusinessDaysInCurrentMonth = () => {
const momentListOfDays = moment().monthBusinessDays();
// TODO This is probably broken :/
console.log('Hit!!!!')
const momentListOfDays = dayjs().businessDaysInMonth();
return momentListOfDays.map((i) => i.format("YYYY-MM-DD"));
};
export const ListOfDaysInCurrentMonth = () => {
const days = [];
const dateStart = moment().startOf("month");
const dateEnd = moment().endOf("month");
const dateStart = dayjs().startOf("month");
const dateEnd = dayjs().endOf("month");
while (dateEnd.diff(dateStart, "days") > 0) {
days.push(dateStart.format("YYYY-MM-DD"));
dateStart.add(1, "days");
@@ -77,8 +79,8 @@ export const ListOfDaysInCurrentMonth = () => {
export const ListDaysBetween = ({ start, end }) => {
const days = [];
const dateStart = moment(start);
const dateEnd = moment(end);
const dateStart = dayjs(start);
const dateEnd = dayjs(end);
while (dateEnd.diff(dateStart, "days") > 0) {
days.push(dateStart.format("YYYY-MM-DD"));
dateStart.add(1, "days");

View File

@@ -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 React, { useMemo } from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
@@ -29,24 +29,24 @@ export default connect(
export function ScoreboardTimeTicketsStats({ bodyshop }) {
const { t } = useTranslation();
const startDate = moment().startOf("month")
const endDate = moment().endOf("month");
const startDate = dayjs().startOf("month")
const endDate = dayjs().endOf("month");
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 endOfPriorWeek = moment().subtract(2, "week").endOf("week");
const startOfPriorWeek = moment().subtract(2, "week").startOf("week");
const endOfPriorWeek = dayjs().subtract(2, "week").endOf("week");
const startOfPriorWeek = dayjs().subtract(2, "week").startOf("week");
const allDates = [
endOfThisMonth,
@@ -60,8 +60,8 @@ export function ScoreboardTimeTicketsStats({ bodyshop }) {
endOfPriorWeek,
startOfPriorWeek,
];
const start = moment.min(allDates);
const end = moment.max(allDates);
const start = dayjs.min(allDates);
const end = dayjs.max(allDates);
return {
start,
end,
@@ -155,7 +155,7 @@ export function ScoreboardTimeTicketsStats({ bodyshop }) {
};
data.fixedperiod.forEach((ticket) => {
const ticketDate = moment(ticket.date);
const ticketDate = dayjs(ticket.date);
if (
ticketDate.isBetween(
fixedPeriods.startOfThisWeek,
@@ -172,24 +172,24 @@ export function ScoreboardTimeTicketsStats({ bodyshop }) {
//Seperate out to Day of Week
ret.seperatedThisWeek[
moment(ticket.date).format("dddd").toLowerCase()
dayjs(ticket.date).format("dddd").toLowerCase()
].total =
ret.seperatedThisWeek[
moment(ticket.date).format("dddd").toLowerCase()
dayjs(ticket.date).format("dddd").toLowerCase()
].total + ticket.productivehrs;
if (ticket.ciecacode !== "LAR")
ret.seperatedThisWeek[
moment(ticket.date).format("dddd").toLowerCase()
dayjs(ticket.date).format("dddd").toLowerCase()
].lab =
ret.seperatedThisWeek[
moment(ticket.date).format("dddd").toLowerCase()
dayjs(ticket.date).format("dddd").toLowerCase()
].lab + ticket.productivehrs;
if (ticket.ciecacode === "LAR")
ret.seperatedThisWeek[
moment(ticket.date).format("dddd").toLowerCase()
dayjs(ticket.date).format("dddd").toLowerCase()
].lar =
ret.seperatedThisWeek[
moment(ticket.date).format("dddd").toLowerCase()
dayjs(ticket.date).format("dddd").toLowerCase()
].lar + ticket.productivehrs;
} else if (
ticketDate.isBetween(
@@ -280,7 +280,7 @@ export function ScoreboardTimeTicketsStats({ bodyshop }) {
listOfDays.forEach((day) => {
const r = {
date: moment(day).format("MM/DD"),
date: dayjs(day).format("MM/DD"),
actualhrs: 0,
productivehrs: 0,
};

View File

@@ -8,7 +8,7 @@ import {
Switch,
Typography,
} 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";
@@ -49,8 +49,8 @@ export function ScoreboardTicketsStats({ data, bodyshop }) {
const statisticWeight = isLarge ? 550 : "normal";
const daySpan =
Util.CalculateWorkingDaysInPeriod(
moment().startOf("week"),
moment().endOf("week")
dayjs().startOf("week"),
dayjs().endOf("week")
) > 5
? 3
: 4;
@@ -170,14 +170,14 @@ export function ScoreboardTicketsStats({ data, bodyshop }) {
parseFloat(data.totalThisWeek) >=
Util.WeeklyTargetHrsInPeriod(
bodyshop.scoreboard_target.dailyBodyTarget,
moment().startOf("week"),
moment().endOf("week"),
dayjs().startOf("week"),
dayjs().endOf("week"),
bodyshop
) +
Util.WeeklyTargetHrsInPeriod(
bodyshop.scoreboard_target.dailyPaintTarget,
moment().startOf("week"),
moment().endOf("week"),
dayjs().startOf("week"),
dayjs().endOf("week"),
bodyshop
)
? "green"
@@ -202,8 +202,8 @@ export function ScoreboardTicketsStats({ data, bodyshop }) {
parseFloat(data.totalThisWeekLAB) >=
Util.WeeklyTargetHrsInPeriod(
bodyshop.scoreboard_target.dailyBodyTarget,
moment().startOf("week"),
moment().endOf("week"),
dayjs().startOf("week"),
dayjs().endOf("week"),
bodyshop
)
? "green"
@@ -226,8 +226,8 @@ export function ScoreboardTicketsStats({ data, bodyshop }) {
parseFloat(data.totalThisWeekLAR) >=
Util.WeeklyTargetHrsInPeriod(
bodyshop.scoreboard_target.dailyPaintTarget,
moment().startOf("week"),
moment().endOf("week"),
dayjs().startOf("week"),
dayjs().endOf("week"),
bodyshop
)
? "green"
@@ -252,14 +252,14 @@ export function ScoreboardTicketsStats({ data, bodyshop }) {
parseFloat(data.totalLastWeek) >=
Util.WeeklyTargetHrsInPeriod(
bodyshop.scoreboard_target.dailyBodyTarget,
moment().subtract(1, "week").startOf("week"),
moment().subtract(1, "week").endOf("week"),
dayjs().subtract(1, "week").startOf("week"),
dayjs().subtract(1, "week").endOf("week"),
bodyshop
) +
Util.WeeklyTargetHrsInPeriod(
bodyshop.scoreboard_target.dailyPaintTarget,
moment().subtract(1, "week").startOf("week"),
moment().subtract(1, "week").endOf("week"),
dayjs().subtract(1, "week").startOf("week"),
dayjs().subtract(1, "week").endOf("week"),
bodyshop
)
? "green"
@@ -284,8 +284,8 @@ export function ScoreboardTicketsStats({ data, bodyshop }) {
parseFloat(data.totalLastWeekLAB) >=
Util.WeeklyTargetHrsInPeriod(
bodyshop.scoreboard_target.dailyBodyTarget,
moment().subtract(1, "week").startOf("week"),
moment().subtract(1, "week").endOf("week"),
dayjs().subtract(1, "week").startOf("week"),
dayjs().subtract(1, "week").endOf("week"),
bodyshop
)
? "green"
@@ -308,8 +308,8 @@ export function ScoreboardTicketsStats({ data, bodyshop }) {
parseFloat(data.totalLastWeekLAR) >=
Util.WeeklyTargetHrsInPeriod(
bodyshop.scoreboard_target.dailyPaintTarget,
moment().subtract(1, "week").startOf("week"),
moment().subtract(1, "week").endOf("week"),
dayjs().subtract(1, "week").startOf("week"),
dayjs().subtract(1, "week").endOf("week"),
bodyshop
)
? "green"
@@ -334,14 +334,14 @@ export function ScoreboardTicketsStats({ data, bodyshop }) {
parseFloat(data.totalPriorWeek) >=
Util.WeeklyTargetHrsInPeriod(
bodyshop.scoreboard_target.dailyBodyTarget,
moment().subtract(2, "week").startOf("week"),
moment().subtract(2, "week").endOf("week"),
dayjs().subtract(2, "week").startOf("week"),
dayjs().subtract(2, "week").endOf("week"),
bodyshop
) +
Util.WeeklyTargetHrsInPeriod(
bodyshop.scoreboard_target.dailyPaintTarget,
moment().subtract(2, "week").startOf("week"),
moment().subtract(2, "week").endOf("week"),
dayjs().subtract(2, "week").startOf("week"),
dayjs().subtract(2, "week").endOf("week"),
bodyshop
)
? "green"
@@ -366,8 +366,8 @@ export function ScoreboardTicketsStats({ data, bodyshop }) {
parseFloat(data.totalPriorWeekLAB) >=
Util.WeeklyTargetHrsInPeriod(
bodyshop.scoreboard_target.dailyBodyTarget,
moment().subtract(2, "week").startOf("week"),
moment().subtract(2, "week").endOf("week"),
dayjs().subtract(2, "week").startOf("week"),
dayjs().subtract(2, "week").endOf("week"),
bodyshop
)
? "green"
@@ -390,8 +390,8 @@ export function ScoreboardTicketsStats({ data, bodyshop }) {
parseFloat(data.totalPriorWeekLAR) >=
Util.WeeklyTargetHrsInPeriod(
bodyshop.scoreboard_target.dailyPaintTarget,
moment().subtract(2, "week").startOf("week"),
moment().subtract(2, "week").endOf("week"),
dayjs().subtract(2, "week").startOf("week"),
dayjs().subtract(2, "week").endOf("week"),
bodyshop
)
? "green"

View File

@@ -1,6 +1,6 @@
import { CalendarOutlined } from "@ant-design/icons";
import { Card, Col, Divider, Row, Statistic } from "antd";
import moment from "moment";
import dayjs from "../../utils/day";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
@@ -46,8 +46,8 @@ export function ScoreboardTimeticketsTargetsTable({ bodyshop }) {
title={t("scoreboard.labels.thisweek")}
value={Util.WeeklyTargetHrs(
bodyshop.scoreboard_target.dailyBodyTarget,
moment().startOf("week"),
moment().endOf("week"),
dayjs().startOf("week"),
dayjs().endOf("week"),
bodyshop
)}
/>
@@ -57,8 +57,8 @@ export function ScoreboardTimeticketsTargetsTable({ bodyshop }) {
title={t("scoreboard.labels.lastweek")}
value={Util.WeeklyTargetHrs(
bodyshop.scoreboard_target.dailyBodyTarget,
moment().subtract(1, "week").startOf("week"),
moment().subtract(1, "week").endOf("week"),
dayjs().subtract(1, "week").startOf("week"),
dayjs().subtract(1, "week").endOf("week"),
bodyshop
)}
/>
@@ -68,8 +68,8 @@ export function ScoreboardTimeticketsTargetsTable({ bodyshop }) {
title={t("scoreboard.labels.priorweek")}
value={Util.WeeklyTargetHrs(
bodyshop.scoreboard_target.dailyBodyTarget,
moment().subtract(2, "week").startOf("week"),
moment().subtract(2, "week").endOf("week"),
dayjs().subtract(2, "week").startOf("week"),
dayjs().subtract(2, "week").endOf("week"),
bodyshop
)}
/>
@@ -113,8 +113,8 @@ export function ScoreboardTimeticketsTargetsTable({ bodyshop }) {
<Statistic
value={Util.WeeklyTargetHrsInPeriod(
bodyshop.scoreboard_target.dailyPaintTarget,
moment().startOf("week"),
moment().endOf("week"),
dayjs().startOf("week"),
dayjs().endOf("week"),
bodyshop
)}
/>
@@ -123,8 +123,8 @@ export function ScoreboardTimeticketsTargetsTable({ bodyshop }) {
<Statistic
value={Util.WeeklyTargetHrs(
bodyshop.scoreboard_target.dailyPaintTarget,
moment().subtract(1, "week").startOf("week"),
moment().subtract(1, "week").endOf("week"),
dayjs().subtract(1, "week").startOf("week"),
dayjs().subtract(1, "week").endOf("week"),
bodyshop
)}
/>
@@ -133,8 +133,8 @@ export function ScoreboardTimeticketsTargetsTable({ bodyshop }) {
<Statistic
value={Util.WeeklyTargetHrs(
bodyshop.scoreboard_target.dailyPaintTarget,
moment().subtract(2, "week").startOf("week"),
moment().subtract(2, "week").endOf("week"),
dayjs().subtract(2, "week").startOf("week"),
dayjs().subtract(2, "week").endOf("week"),
bodyshop
)}
/>
@@ -182,14 +182,14 @@ export function ScoreboardTimeticketsTargetsTable({ bodyshop }) {
value={(
Util.WeeklyTargetHrs(
bodyshop.scoreboard_target.dailyBodyTarget,
moment().startOf("week"),
moment().endOf("week"),
dayjs().startOf("week"),
dayjs().endOf("week"),
bodyshop
) +
Util.WeeklyTargetHrs(
bodyshop.scoreboard_target.dailyPaintTarget,
moment().startOf("week"),
moment().endOf("week"),
dayjs().startOf("week"),
dayjs().endOf("week"),
bodyshop
)
).toFixed(1)}
@@ -200,14 +200,14 @@ export function ScoreboardTimeticketsTargetsTable({ bodyshop }) {
value={(
Util.WeeklyTargetHrs(
bodyshop.scoreboard_target.dailyBodyTarget,
moment().subtract(1, "week").startOf("week"),
moment().subtract(1, "week").endOf("week"),
dayjs().subtract(1, "week").startOf("week"),
dayjs().subtract(1, "week").endOf("week"),
bodyshop
) +
Util.WeeklyTargetHrs(
bodyshop.scoreboard_target.dailyPaintTarget,
moment().subtract(1, "week").startOf("week"),
moment().subtract(1, "week").endOf("week"),
dayjs().subtract(1, "week").startOf("week"),
dayjs().subtract(1, "week").endOf("week"),
bodyshop
)
).toFixed(1)}
@@ -218,14 +218,14 @@ export function ScoreboardTimeticketsTargetsTable({ bodyshop }) {
value={(
Util.WeeklyTargetHrs(
bodyshop.scoreboard_target.dailyBodyTarget,
moment().subtract(2, "week").startOf("week"),
moment().subtract(2, "week").endOf("week"),
dayjs().subtract(2, "week").startOf("week"),
dayjs().subtract(2, "week").endOf("week"),
bodyshop
) +
Util.WeeklyTargetHrs(
bodyshop.scoreboard_target.dailyPaintTarget,
moment().subtract(2, "week").startOf("week"),
moment().subtract(2, "week").endOf("week"),
dayjs().subtract(2, "week").startOf("week"),
dayjs().subtract(2, "week").endOf("week"),
bodyshop
)
).toFixed(1)}

View File

@@ -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: {},

View File

@@ -1,6 +1,6 @@
import { useMutation } from "@apollo/client";
import { Button, Card, Form, notification, Popover, Space } from "antd";
import moment from "moment";
import dayjs from "../../utils/day";
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import { logImEXEvent } from "../../firebase/firebase.utils";
@@ -78,7 +78,7 @@ export default function ShopEmployeeAddVacation({ employee }) {
async validator(rule, value) {
if (value) {
const { start } = form.getFieldsValue();
if (moment(start).isAfter(moment(value))) {
if (dayjs(start).isAfter(dayjs(value))) {
return Promise.reject(
t("employees.labels.endmustbeafterstart")
);

View File

@@ -12,7 +12,7 @@ import {
Table,
} from "antd";
import { useForm } from "antd/es/form/Form";
import moment from "moment";
import dayjs from "../../utils/day";
import React, { useEffect } from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
@@ -132,7 +132,7 @@ export function ShopEmployeesFormComponent({ bodyshop }) {
dataIndex: "length",
key: "length",
render: (text, record) =>
moment(record.end).diff(moment(record.start), "days", true).toFixed(1),
dayjs(record.end).diff(dayjs(record.start), "days", true).toFixed(1),
},
{
title: t("general.labels.actions"),

View File

@@ -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 { logImEXEvent } from "../../firebase/firebase.utils";
@@ -58,21 +58,21 @@ export default function ShopInfoContainer() {
accountingconfig: {
...data.bodyshops[0].accountingconfig,
ClosingPeriod: [
moment(data.bodyshops[0].accountingconfig.ClosingPeriod[0]),
moment(data.bodyshops[0].accountingconfig.ClosingPeriod[1]),
dayjs(data.bodyshops[0].accountingconfig.ClosingPeriod[0]),
dayjs(data.bodyshops[0].accountingconfig.ClosingPeriod[1]),
],
},
schedule_start_time: moment(
schedule_start_time: dayjs(
data.bodyshops[0].schedule_start_time
),
schedule_end_time: moment(data.bodyshops[0].schedule_end_time),
schedule_end_time: dayjs(data.bodyshops[0].schedule_end_time),
}
: {
...data.bodyshops[0],
schedule_start_time: moment(
schedule_start_time: dayjs(
data.bodyshops[0].schedule_start_time
),
schedule_end_time: moment(data.bodyshops[0].schedule_end_time),
schedule_end_time: dayjs(data.bodyshops[0].schedule_end_time),
}
: null
}

View File

@@ -11,7 +11,6 @@ import {
Space,
Switch,
} from "antd";
import momentTZ from "moment-timezone";
import React from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
@@ -25,7 +24,8 @@ import PhoneFormItem, {
} from "../form-items-formatted/phone-form-item.component";
import FormListMoveArrows from "../form-list-move-arrows/form-list-move-arrows.component";
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
const timeZonesList = momentTZ.tz.names();
// TODO: Client Update, this might break
const timeZonesList = Intl.supportedValuesOf('timeZone');
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop,
});

View File

@@ -1,8 +1,7 @@
import { useMutation } from "@apollo/client";
import { Button, Card, Form, notification, Space } from "antd";
import axios from "axios";
import moment from "moment";
import momenttz from "moment-timezone";
import dayjs from "../../utils/day";
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
@@ -58,13 +57,14 @@ export function TechClockInContainer({
employeeid: technician.id,
date:
typeof bodyshop.timezone === "string"
? momenttz.tz(theTime, bodyshop.timezone).format("YYYY-MM-DD")
// TODO: Client Update - This may be broken
? dayjs.tz(theTime, bodyshop.timezone).format("YYYY-MM-DD")
: typeof bodyshop.timezone === "number"
? moment(theTime)
? dayjs(theTime)
.format("YYYY-MM-DD")
.utcOffset(bodyshop.timezone)
: moment(theTime).format("YYYY-MM-DD"),
clockon: moment(theTime),
: dayjs(theTime).format("YYYY-MM-DD"),
clockon: dayjs(theTime),
jobid: values.jobid,
cost_center: values.cost_center,
ciecacode:

View File

@@ -1,5 +1,5 @@
import { Button, Card, DatePicker, Form, Popover, Radio, Space } 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";
@@ -51,13 +51,13 @@ export function TechJobPrintTickets({ technician, event, attendacePrint }) {
: Templates.timetickets_employee.key,
variables: {
...(start
? { start: moment(start).startOf("day").format("YYYY-MM-DD") }
? { start: dayjs(start).startOf("day").format("YYYY-MM-DD") }
: {}),
...(end
? { end: moment(end).endOf("day").format("YYYY-MM-DD") }
? { end: dayjs(end).endOf("day").format("YYYY-MM-DD") }
: {}),
...(start ? { starttz: moment(start).startOf("day") } : {}),
...(end ? { endtz: moment(end).endOf("day") } : {}),
...(start ? { starttz: dayjs(start).startOf("day") } : {}),
...(end ? { endtz: dayjs(end).endOf("day") } : {}),
id: technician.id,
},

View File

@@ -1,6 +1,6 @@
import { useQuery } from "@apollo/client";
import { Card, Col, Space, Statistic, Typography } from "antd";
import moment from "moment";
import dayjs from "../../utils/day";
import { useMemo } from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
@@ -19,8 +19,8 @@ const mapDispatchToProps = (dispatch) => ({});
const TechJobStatistics = ({ technician }) => {
const { t } = useTranslation();
const startDate = moment().startOf("week");
const endDate = moment().endOf("week");
const startDate = dayjs().startOf("week");
const endDate = dayjs().endOf("week");
const { loading, error, data } = useQuery(
QUERY_TIME_TICKETS_TECHNICIAN_IN_RANGE,
@@ -28,8 +28,8 @@ const TechJobStatistics = ({ technician }) => {
variables: {
start: startDate.format("YYYY-MM-DD"),
end: endDate.format("YYYY-MM-DD"),
fixedStart: moment().startOf("month").format("YYYY-MM-DD"),
fixedEnd: moment().endOf("month").format("YYYY-MM-DD"),
fixedStart: dayjs().startOf("month").format("YYYY-MM-DD"),
fixedEnd: dayjs().endOf("month").format("YYYY-MM-DD"),
employeeid: technician.id,
},
fetchPolicy: "network-only",

View File

@@ -1,6 +1,6 @@
import DatePickerRanges from "../../utils/DatePickerRanges";
import { DatePicker } from "antd";
import moment from "moment";
import dayjs from "../../utils/day";
import queryString from "query-string";
import React from "react";
import { useNavigate, useLocation } from "react-router-dom";
@@ -37,8 +37,8 @@ export default function TimeTicketsDatesSelector() {
return (
<DatePicker.RangePicker
defaultValue={[
start ? moment(start) : moment().startOf("week").subtract(7, "days"),
end ? moment(end) : moment().endOf("week"),
start ? dayjs(start) : dayjs().startOf("week").subtract(7, "days"),
end ? dayjs(end) : dayjs().endOf("week"),
]}
format="MM/DD/YYYY"
ranges={DatePickerRanges}

View File

@@ -1,6 +1,6 @@
import { EditFilled } from "@ant-design/icons";
import { Card, Space, Table } from "antd";
import moment from "moment";
import dayjs from "../../utils/day";
import React, { useMemo, useState } from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
@@ -186,8 +186,8 @@ export function TimeTicketList({
if (record.clockoff && record.clockon)
return (
<div>
{moment(record.clockoff)
.diff(moment(record.clockon), "hours", true)
{dayjs(record.clockoff)
.diff(dayjs(record.clockon), "hours", true)
.toFixed(2)}
</div>
);

View File

@@ -291,6 +291,7 @@ export function TimeTicketModalComponent({
return Promise.reject(
t("timetickets.validation.clockoffwithoutclockon")
);
// TODO - Verify this exists
if (
value &&
value.isSameOrAfter &&

View File

@@ -1,7 +1,7 @@
import { useMutation, useQuery } from "@apollo/client";
import { Button, Form, Modal, Space, notification } from "antd";
import {PageHeader} from "@ant-design/pro-layout";
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";
@@ -210,7 +210,7 @@ export function TimeTicketModalContainer({
timeTicketModal.context.timeticket.jobid ||
null,
date: timeTicketModal.context.timeticket.date
? moment(timeTicketModal.context.timeticket.date)
? dayjs(timeTicketModal.context.timeticket.date)
: null,
}
: { jobid: timeTicketModal.context.jobId || null }

View File

@@ -1,8 +1,7 @@
import { useMutation } from "@apollo/client";
import { Button, Form, Space, notification } from "antd";
import axios from "axios";
import moment from "moment";
import momenttz from "moment-timezone";
import dayjs from "../../utils/day";
import React, { useMemo, useState } from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
@@ -59,7 +58,7 @@ export function TimeTicektShiftContainer({
message: t("timetickets.errors.shiftalreadyclockedon"),
});
} else {
const theTime = moment((await axios.post("/utils/time")).data);
const theTime = dayjs((await axios.post("/utils/time")).data);
const result = await insertTimeTicket({
variables: {
@@ -71,12 +70,13 @@ export function TimeTicektShiftContainer({
clockon: theTime,
date:
typeof bodyshop.timezone === "string"
? momenttz.tz(theTime, bodyshop.timezone).format("YYYY-MM-DD")
// TODO: Client Update - This may be broken
? dayjs.tz(theTime, bodyshop.timezone).format("YYYY-MM-DD")
: typeof bodyshop.timezone === "number"
? moment(theTime)
? dayjs(theTime)
.utcOffset(bodyshop.timezone)
.format("YYYY-MM-DD")
: moment(theTime).format("YYYY-MM-DD"),
: dayjs(theTime).format("YYYY-MM-DD"),
memo: values.memo,
created_by: isTechConsole
? currentUser.email.concat(

View File

@@ -5,7 +5,7 @@ import { useLocation } from "react-router-dom";
import { GenerateDocument } from "../../utils/RenderTemplate";
import { TemplateList } from "../../utils/TemplateConstants";
import { useTranslation } from "react-i18next";
import moment from "moment";
import dayjs from "../../utils/day";
const AttendanceCsv = TemplateList("special").attendance_detail_csv;
export default function TimeTicketsAttendanceTable() {
@@ -23,8 +23,8 @@ export default function TimeTicketsAttendanceTable() {
variables: {
start: start
? start
: moment().startOf("week").subtract(7, "days").format("YYYY-MM-DD"),
end: end ? end : moment().endOf("week").format("YYYY-MM-DD"),
: dayjs().startOf("week").subtract(7, "days").format("YYYY-MM-DD"),
end: end ? end : dayjs().endOf("week").format("YYYY-MM-DD"),
},
},
{},

View File

@@ -5,7 +5,7 @@ import { useLocation } from "react-router-dom";
import { GenerateDocument } from "../../utils/RenderTemplate";
import { TemplateList } from "../../utils/TemplateConstants";
import { useTranslation } from "react-i18next";
import moment from "moment";
import dayjs from "../../utils/day";
const PayrollTemplate = TemplateList("special").exported_payroll;
export default function TimeTicketsPayrollTable() {
const searchParams = queryString.parse(useLocation().search);
@@ -22,8 +22,8 @@ export default function TimeTicketsPayrollTable() {
variables: {
start: start
? start
: moment().startOf("week").subtract(7, "days").format("YYYY-MM-DD"),
end: end ? end : moment().endOf("week").format("YYYY-MM-DD"),
: dayjs().startOf("week").subtract(7, "days").format("YYYY-MM-DD"),
end: end ? end : dayjs().endOf("week").format("YYYY-MM-DD"),
},
},
{},

View File

@@ -1,6 +1,6 @@
import { Card, Col, Row, Table } from "antd";
import _ from "lodash";
import moment from "moment";
import dayjs from "../../utils/day";
import React, { useMemo, useState } from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
@@ -124,7 +124,7 @@ const JobRelatedTicketsTable = ({
if (!!val.clockoff && !!val.clockon)
return (
acc +
moment(val.clockoff).diff(moment(val.clockon), "hours", true)
dayjs(val.clockoff).diff(dayjs(val.clockon), "hours", true)
);
return acc;
}, 0);
@@ -251,7 +251,7 @@ const ShiftRelatedTicketsTable = ({
const clockHrs = item.tickets.reduce((acc, val) => {
if (!!val.clockoff && !!val.clockon)
return (
acc + moment(val.clockoff).diff(moment(val.clockon), "hours", true)
acc + dayjs(val.clockoff).diff(dayjs(val.clockon), "hours", true)
);
return acc;
}, 0);

View File

@@ -4,7 +4,7 @@ import {PageHeader} from "@ant-design/pro-layout";
import { useMutation } from "@apollo/client";
import VehicleDetailFormComponent from "./vehicle-detail-form.component";
import { useTranslation } from "react-i18next";
import moment from "moment";
import dayjs from "../../utils/day";
import { DELETE_VEHICLE, UPDATE_VEHICLE } from "../../graphql/vehicles.queries";
import { useNavigate } from "react-router-dom";
@@ -97,7 +97,7 @@ function VehicleDetailFormContainer({ vehicle, refetch }) {
layout="vertical"
initialValues={{
...vehicle,
v_prod_dt: vehicle.v_prod_dt ? moment(vehicle.v_prod_dt) : null,
v_prod_dt: vehicle.v_prod_dt ? dayjs(vehicle.v_prod_dt) : null,
}}
>
<VehicleDetailFormComponent form={form} loading={loading} />

View File

@@ -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,
}}
>

View File

@@ -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,
}
: {}

View File

@@ -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>

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")
)

View File

@@ -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,
};
};

View File

@@ -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: {

View File

@@ -1,4 +1,4 @@
import moment from "moment";
import dayjs from "../../utils/day";
import { all, call, put, select, takeLatest } from "redux-saga/effects";
import { QUERY_SCHEDULE_LOAD_DATA } from "../../graphql/appointments.queries";
import { INSERT_AUDIT_TRAIL } from "../../graphql/audit_trail.queries";
@@ -18,8 +18,8 @@ export function* onCalculateScheduleLoad() {
);
}
export function* calculateScheduleLoad({ payload: end }) {
//REMINDER: Moment.js is not immutable. Today WILL change when adjusted.
const today = moment().startOf("day");
//REMINDER: dayjs.js is not immutable. Today WILL change when adjusted.
const today = dayjs().startOf("day");
const state = yield select();
const buckets = state.user.bodyshop.ssbuckets;
@@ -47,7 +47,7 @@ export function* calculateScheduleLoad({ payload: end }) {
//Add all of the jobs currently in production to the buckets so that we have a starting point.
if (
!item.actual_completion &&
moment(item.scheduled_completion).isBefore(moment().startOf("day"))
dayjs(item.scheduled_completion).isBefore(dayjs().startOf("day"))
) {
problemJobs.push({
...item,
@@ -57,7 +57,7 @@ export function* calculateScheduleLoad({ payload: end }) {
if (
item.actual_completion &&
moment(item.actual_completion).isBefore(moment().startOf("day"))
dayjs(item.actual_completion).isBefore(dayjs().startOf("day"))
) {
problemJobs.push({
...item,
@@ -98,7 +98,7 @@ export function* calculateScheduleLoad({ payload: end }) {
code: "Job has an actual in date, but no actual completion date and is not marked as in production",
});
}
if (item.actual_in && moment(item.actual_in).isAfter(moment())) {
if (item.actual_in && dayjs(item.actual_in).isAfter(dayjs())) {
problemJobs.push({
...item,
code: "Job has an actual in date set in the future",
@@ -106,7 +106,7 @@ export function* calculateScheduleLoad({ payload: end }) {
}
if (
item.actual_completion &&
moment(item.actual_completion).isAfter(moment())
dayjs(item.actual_completion).isAfter(dayjs())
) {
problemJobs.push({
...item,
@@ -120,7 +120,7 @@ export function* calculateScheduleLoad({ payload: end }) {
});
}
const itemDate = moment(item.actual_in || item.scheduled_in).format(
const itemDate = dayjs(item.actual_in || item.scheduled_in).format(
"yyyy-MM-DD"
);
@@ -169,7 +169,7 @@ export function* calculateScheduleLoad({ payload: end }) {
const AddJobForSchedulingCalc = inProdJobs || inArrJobs;
const itemDate = moment(
const itemDate = dayjs(
item.actual_completion || item.scheduled_completion
).format("yyyy-MM-DD");
//Skip it, it's already completed.
@@ -207,10 +207,10 @@ export function* calculateScheduleLoad({ payload: end }) {
//Propagate the expected load to each day.
const range = Math.round(moment.duration(end.diff(today)).asDays()) + 1;
const range = Math.round(dayjs.duration(end.diff(today)).asDays()) + 1;
for (var day = 0; day < range; day++) {
const current = moment(today).add(day, "days").format("yyyy-MM-DD");
const prev = moment(today)
const current = dayjs(today).add(day, "days").format("yyyy-MM-DD");
const prev = dayjs(today)
.add(day - 1, "days")
.format("yyyy-MM-DD");
if (!!!load[current]) {

View File

@@ -268,7 +268,7 @@ export function* SetAuthLevelFromShopDetails({ payload }) {
const userEmail = yield select((state) => state.user.currentUser.email);
try {
//console.log("Setting shop timezone.");
// moment.tz.setDefault(payload.timezone);
// dayjs.tz.setDefault(payload.timezone);
} catch (error) {
console.log(error);
}

View File

@@ -1,10 +1,10 @@
import { Tooltip } from "antd";
import moment from "moment";
import dayjs from "../utils/day";
import React from "react";
export function DateFormatter(props) {
return props.children
? moment(props.children).format(
? dayjs(props.children).format(
props.includeDay ? "ddd MM/DD/YYYY" : "MM/DD/YYYY"
)
: null;
@@ -12,19 +12,19 @@ export function DateFormatter(props) {
export function DateTimeFormatter(props) {
return props.children
? moment(props.children).format(
? dayjs(props.children).format(
props.format ? props.format : "MM/DD/YYYY hh:mm a"
)
: null;
}
export function TimeFormatter(props) {
return props.children
? moment(props.children).format(props.format ? props.format : "hh:mm a")
? dayjs(props.children).format(props.format ? props.format : "hh:mm a")
: null;
}
export function TimeAgoFormatter(props) {
const m = moment(props.children);
const m = dayjs(props.children);
return props.children ? (
<Tooltip placement="top" title={m.format("MM/DD/YYY hh:mm A")}>
{m.fromNow()}
@@ -33,5 +33,5 @@ export function TimeAgoFormatter(props) {
}
export function DateTimeFormat(value) {
return moment(value).format("MM/DD/YYYY hh:mm A");
return dayjs(value).format("MM/DD/YYYY hh:mm A");
}

View File

@@ -1,27 +1,27 @@
import moment from "moment";
import dayjs from "./day";
const range = {
Today: [moment(), moment()],
"Last 14 days": [moment().subtract(14, "days"), moment()],
"Last 7 days": [moment().subtract(7, "days"), moment()],
"Next 7 days": [moment(), moment().add(7, "days")],
"Next 14 days": [moment(), moment().add(14, "days")],
Today: [dayjs(), dayjs()],
"Last 14 days": [dayjs().subtract(14, "days"), dayjs()],
"Last 7 days": [dayjs().subtract(7, "days"), dayjs()],
"Next 7 days": [dayjs(), dayjs().add(7, "days")],
"Next 14 days": [dayjs(), dayjs().add(14, "days")],
"Last Month": [
moment().startOf("month").subtract(1, "month"),
moment().startOf("month").subtract(1, "month").endOf("month"),
dayjs().startOf("month").subtract(1, "month"),
dayjs().startOf("month").subtract(1, "month").endOf("month"),
],
"This Month": [moment().startOf("month"), moment().endOf("month")],
"This Month": [dayjs().startOf("month"), dayjs().endOf("month")],
"Next Month": [
moment().startOf("month").add(1, "month"),
moment().startOf("month").add(1, "month").endOf("month"),
dayjs().startOf("month").add(1, "month"),
dayjs().startOf("month").add(1, "month").endOf("month"),
],
"Last Quarter": [
moment().startOf("quarter").subtract(1, "quarters"),
moment().startOf("quarter").subtract(1, "day"),
dayjs().startOf("quarter").subtract(1, "quarters"),
dayjs().startOf("quarter").subtract(1, "day"),
],
"This Quarter": [
moment().startOf("quarter"),
moment().startOf("quarter").add(1, "quarter").subtract(1, "day"),
dayjs().startOf("quarter"),
dayjs().startOf("quarter").add(1, "quarter").subtract(1, "day"),
],
"Last 90 Days": [moment().add(-90, "days"), moment()],
"Last 90 Days": [dayjs().add(-90, "days"), dayjs()],
};
export default range;

View File

@@ -73,7 +73,7 @@ export default async function RenderTemplate(
headerpath: `/${bodyshop.imexshopid}/header.html`,
footerpath: `/${bodyshop.imexshopid}/footer.html`,
bodyshop: bodyshop,
offset: bodyshop.timezone, //moment().utcOffset(),
offset: bodyshop.timezone, //dayjs().utcOffset(),
},
};

15
client/src/utils/day.js Normal file
View File

@@ -0,0 +1,15 @@
import dayjs from 'dayjs';
import dayjsBusinessDays from "dayjs-business-days2";
import isSameOrAfter from "dayjs/plugin/isSameOrAfter";
import isSameOrBefore from "dayjs/plugin/isSameOrBefore";
import timezone from 'dayjs/plugin/timezone';
import utc from 'dayjs/plugin/utc';
dayjs.extend(utc);
dayjs.extend(timezone);
dayjs.extend(dayjsBusinessDays);
dayjs.extend(isSameOrAfter);
dayjs.extend(isSameOrBefore);
export default dayjs;