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

342
client/package-lock.json generated
View File

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

View File

@@ -11,14 +11,16 @@
"@craco/craco": "^7.1.0", "@craco/craco": "^7.1.0",
"@fingerprintjs/fingerprintjs": "^4.2.1", "@fingerprintjs/fingerprintjs": "^4.2.1",
"@jsreport/browser-client": "^3.1.0", "@jsreport/browser-client": "^3.1.0",
"@sentry/react": "^7.86.0", "@sentry/react": "^7.87.0",
"@sentry/tracing": "^7.86.0", "@sentry/tracing": "^7.87.0",
"@splitsoftware/splitio-react": "^1.10.2", "@splitsoftware/splitio-react": "^1.10.2",
"@tanem/react-nprogress": "^5.0.51", "@tanem/react-nprogress": "^5.0.51",
"antd": "^5.12.2", "antd": "^5.12.2",
"apollo-link-logger": "^2.0.1", "apollo-link-logger": "^2.0.1",
"axios": "^1.3.6", "axios": "^1.3.6",
"craco-less": "^3.0.1", "craco-less": "^3.0.1",
"dayjs": "^1.11.10",
"dayjs-business-days2": "^1.2.2",
"dinero.js": "^1.9.1", "dinero.js": "^1.9.1",
"dotenv": "^16.3.1", "dotenv": "^16.3.1",
"enquire-js": "^0.2.1", "enquire-js": "^0.2.1",
@@ -33,8 +35,6 @@
"libphonenumber-js": "^1.10.51", "libphonenumber-js": "^1.10.51",
"logrocket": "^7.0.0", "logrocket": "^7.0.0",
"markerjs2": "^2.31.4", "markerjs2": "^2.31.4",
"moment-business-days": "^1.2.0",
"moment-timezone": "^0.5.43",
"normalize-url": "^8.0.0", "normalize-url": "^8.0.0",
"phone": "^3.1.41", "phone": "^3.1.41",
"preval.macro": "^5.0.0", "preval.macro": "^5.0.0",
@@ -57,7 +57,7 @@
"react-number-format": "^5.1.4", "react-number-format": "^5.1.4",
"react-redux": "^9.0.4", "react-redux": "^9.0.4",
"react-resizable": "^3.0.5", "react-resizable": "^3.0.5",
"react-router-dom": "^6.20.1", "react-router-dom": "^6.21.0",
"react-scripts": "^5.0.1", "react-scripts": "^5.0.1",
"react-sticky": "^6.0.3", "react-sticky": "^6.0.3",
"react-sublime-video": "^0.2.5", "react-sublime-video": "^0.2.5",
@@ -122,7 +122,6 @@
"react-error-overlay": "6.0.9" "react-error-overlay": "6.0.9"
}, },
"devDependencies": { "devDependencies": {
"@ant-design/moment-webpack-plugin": "^0.0.4",
"@babel/plugin-proposal-private-property-in-object": "^7.21.11", "@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@sentry/webpack-plugin": "^2.10.2", "@sentry/webpack-plugin": "^2.10.2",
"@testing-library/cypress": "^10.0.1", "@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 { SplitFactory, SplitSdk } from "@splitsoftware/splitio-react";
import { ConfigProvider } from "antd"; import { ConfigProvider } from "antd";
import enLocale from "antd/es/locale/en_US"; 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 React from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import GlobalLoadingBar from "../components/global-loading-bar/global-loading-bar.component"; import GlobalLoadingBar from "../components/global-loading-bar/global-loading-bar.component";
import client from "../utils/GraphQLClient"; import client from "../utils/GraphQLClient";
import App from "./App"; import App from "./App";
moment.locale("en-US"); dayjs.locale("en");
export const factory = SplitSdk({ export const factory = SplitSdk({
core: { core: {

View File

@@ -1,6 +1,6 @@
import {useMutation, useQuery} from "@apollo/client"; import {useMutation, useQuery} from "@apollo/client";
import {Button, Form, Popconfirm, Space} from "antd"; import {Button, Form, Popconfirm, Space} from "antd";
import moment from "moment"; import dayjs from "../../utils/day";
import queryString from "query-string"; import queryString from "query-string";
import React, {useState} from "react"; import React, {useState} from "react";
import {useTranslation} from "react-i18next"; 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, Switch,
Upload, Upload,
} from "antd"; } from "antd";
import moment from "moment"; import dayjs from "../../utils/day";
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { MdOpenInNew } from "react-icons/md"; import { MdOpenInNew } from "react-icons/md";
@@ -274,17 +274,17 @@ export function BillFormComponent({
bodyshop.accountingconfig.ClosingPeriod bodyshop.accountingconfig.ClosingPeriod
) { ) {
if ( if (
moment(value) dayjs(value)
.startOf("day") .startOf("day")
.isSameOrAfter( .isSameOrAfter(
moment( dayjs(
bodyshop.accountingconfig.ClosingPeriod[0] bodyshop.accountingconfig.ClosingPeriod[0]
).startOf("day") ).startOf("day")
) && ) &&
moment(value) dayjs(value)
.startOf("day") .startOf("day")
.isSameOrBefore( .isSameOrBefore(
moment( dayjs(
bodyshop.accountingconfig.ClosingPeriod[1] bodyshop.accountingconfig.ClosingPeriod[1]
).endOf("day") ).endOf("day")
) )

View File

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

View File

@@ -13,7 +13,7 @@ import {
notification, notification,
} from "antd"; } from "antd";
import axios from "axios"; import axios from "axios";
import moment from "moment"; import dayjs from "../../utils/day";
import React, { useState } from "react"; import React, { useState } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { connect } from "react-redux"; import { connect } from "react-redux";
@@ -117,7 +117,7 @@ const CardPaymentModalComponent = ({
payer: t("payments.labels.customer"), payer: t("payments.labels.customer"),
type: values.paymentResponse.cardbrand, type: values.paymentResponse.cardbrand,
jobid: payment.jobid, jobid: payment.jobid,
date: moment(Date.now()), date: dayjs(Date.now()),
payment_responses: { payment_responses: {
data: [ data: [
{ {

View File

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

View File

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

View File

@@ -10,7 +10,7 @@ import {
Space, Space,
} from "antd"; } from "antd";
import axios from "axios"; import axios from "axios";
import moment from "moment"; import dayjs from "../../utils/day";
import React, { useState } from "react"; import React, { useState } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { connect } from "react-redux"; import { connect } from "react-redux";
@@ -46,8 +46,8 @@ export function ContractConvertToRo({
const handleFinish = async (values) => { const handleFinish = async (values) => {
setLoading(true); setLoading(true);
const contractLength = moment(contract.actualreturn).diff( const contractLength = dayjs(contract.actualreturn).diff(
moment(contract.start), dayjs(contract.start),
"days" "days"
); );
const billingLines = []; const billingLines = [];

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -7,7 +7,7 @@ import { selectCurrentUser } from "../../redux/user/user.selectors";
import { GenerateDocument } from "../../utils/RenderTemplate"; import { GenerateDocument } from "../../utils/RenderTemplate";
import DateTimePicker from "../form-date-time-picker/form-date-time-picker.component"; import DateTimePicker from "../form-date-time-picker/form-date-time-picker.component";
import LayoutFormRow from "../layout-form-row/layout-form-row.component"; import LayoutFormRow from "../layout-form-row/layout-form-row.component";
import moment from "moment"; import dayjs from "../../utils/day";
const mapStateToProps = createStructuredSelector({ const mapStateToProps = createStructuredSelector({
currentUser: selectCurrentUser, currentUser: selectCurrentUser,
@@ -27,16 +27,16 @@ export function EmailTestComponent({ currentUser, setEmailOptions }) {
variables: { variables: {
...(values.start ...(values.start
? { ? {
start: moment(values.start).startOf("day").format("YYYY-MM-DD"), start: dayjs(values.start).startOf("day").format("YYYY-MM-DD"),
} }
: {}), : {}),
...(values.end ...(values.end
? { end: moment(values.end).endOf("day").format("YYYY-MM-DD") } ? { end: dayjs(values.end).endOf("day").format("YYYY-MM-DD") }
: {}), : {}),
...(values.start ...(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 } : {}), ...(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 React from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { connect } from "react-redux"; import { connect } from "react-redux";
@@ -34,7 +34,7 @@ function FeatureWrapper({
export function HasFeatureAccess({ featureName, bodyshop }) { export function HasFeatureAccess({ featureName, bodyshop }) {
return ( return (
bodyshop.features.allAccess || 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 { DatePicker } from "antd";
import moment from "moment"; import dayjs from "../../utils/day";
import React, { useRef } from "react"; import React, { useRef } from "react";
//To be used as a form element only.
import { connect } from "react-redux"; import { connect } from "react-redux";
import { createStructuredSelector } from "reselect"; import { createStructuredSelector } from "reselect";
import { selectBodyshop } from "../../redux/user/user.selectors"; import { selectBodyshop } from "../../redux/user/user.selectors";
const mapStateToProps = createStructuredSelector({ const mapStateToProps = createStructuredSelector({
//currentUser: selectCurrentUser
bodyshop: selectBodyshop, bodyshop: selectBodyshop,
}); });
const mapDispatchToProps = (dispatch) => ({ const mapDispatchToProps = (dispatch) => ({});
//setUserLanguage: language => dispatch(setUserLanguage(language))
});
export default connect(mapStateToProps, mapDispatchToProps)(FormDatePicker); export default connect(mapStateToProps, mapDispatchToProps)(FormDatePicker);
const dateFormat = "MM/DD/YYYY"; 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({ export function FormDatePicker({
bodyshop, bodyshop,
value, value,
onChange, onChange,
onBlur, onBlur,
onlyFuture, onlyFuture,
isDateOnly = true, isDateOnly = true,
...restProps ...restProps
}) { }) {
const ref = useRef(); const ref = useRef();
const handleChange = (newDate) => { const handleChange = (newDate) => {
@@ -37,8 +35,7 @@ export function FormDatePicker({
const handleKeyDown = (e) => { const handleKeyDown = (e) => {
if (e.key.toLowerCase() === "t") { if (e.key.toLowerCase() === "t") {
if (onChange) { if (onChange) {
onChange(isDateOnly ? moment().format("YYYY-MM-DD") : moment()); onChange(isDateOnly ? dayjs().format("YYYY-MM-DD") : dayjs());
// if (ref.current && ref.current.blur) ref.current.blur();
} }
} else if (e.key.toLowerCase() === "enter") { } else if (e.key.toLowerCase() === "enter") {
if (ref.current && ref.current.blur) ref.current.blur(); if (ref.current && ref.current.blur) ref.current.blur();
@@ -49,14 +46,23 @@ export function FormDatePicker({
const v = e.target.value; const v = e.target.value;
if (!v) return; if (!v) return;
const _a = moment( const _a = dayjs(
v, v,
["MMDDYY", "MMDDYYYY", "MMDD", "MM/DD/YY"], ["MMDDYY", "MMDDYYYY", "MMDD", "MM/DD/YY"],
"en", "en",
false 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({ _a.set({
hours: value.hours(), hours: value.hours(),
minutes: value.minutes(), minutes: value.minutes(),
@@ -67,10 +73,10 @@ export function FormDatePicker({
if (_a.isValid() && onChange) { if (_a.isValid() && onChange) {
if (onlyFuture) { if (onlyFuture) {
if (moment().subtract(1, "day").isBefore(_a)) { if (dayjs().subtract(1, "day").isBefore(_a)) {
onChange(isDateOnly ? _a.format("YYYY-MM-DD") : _a); onChange(isDateOnly ? _a.format("YYYY-MM-DD") : _a);
} else { } else {
onChange(isDateOnly ? moment().format("YYYY-MM-DD") : moment()); onChange(isDateOnly ? dayjs().format("YYYY-MM-DD") : dayjs());
} }
} else { } else {
onChange(isDateOnly ? _a.format("YYYY-MM-DD") : _a); onChange(isDateOnly ? _a.format("YYYY-MM-DD") : _a);
@@ -79,20 +85,20 @@ export function FormDatePicker({
}; };
return ( return (
<div onKeyDown={handleKeyDown}> <div onKeyDown={handleKeyDown}>
<DatePicker <DatePicker
ref={ref} ref={ref}
value={value ? moment(value) : null} value={value ? dayjs(value) : null}
onChange={handleChange} onChange={handleChange}
format={dateFormat} format={dateFormat}
onBlur={onBlur || handleBlur} onBlur={onBlur || handleBlur}
showToday={false} showToday={false}
disabledTime disabledTime
{...(onlyFuture && { {...(onlyFuture && {
disabledDate: (d) => moment().subtract(1, "day").isAfter(d), disabledDate: (d) => dayjs().subtract(1, "day").isAfter(d),
})} })}
{...restProps} {...restProps}
/> />
</div> </div>
); );
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,6 +1,6 @@
import { useMutation } from "@apollo/client"; import { useMutation } from "@apollo/client";
import { Button, Form, notification } from "antd"; import { Button, Form, notification } from "antd";
import moment from "moment"; import dayjs from "../../utils/day";
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { UPDATE_JOB } from "../../graphql/jobs.queries"; import { UPDATE_JOB } from "../../graphql/jobs.queries";
@@ -53,7 +53,7 @@ export function JobsAdminDatesChange({ insertAuditTrail, job }) {
jobid: job.id, jobid: job.id,
operation: AuditTrailMapping.admin_jobfieldchange( operation: AuditTrailMapping.admin_jobfieldchange(
key, key,
changedAuditFields[key] instanceof moment changedAuditFields[key] instanceof dayjs
? DateTimeFormat(changedAuditFields[key]) ? DateTimeFormat(changedAuditFields[key])
: changedAuditFields[key] : changedAuditFields[key]
), ),
@@ -89,7 +89,7 @@ export function JobsAdminDatesChange({ insertAuditTrail, job }) {
initialValues={{ initialValues={{
...job, ...job,
date_estimated: job.date_estimated date_estimated: job.date_estimated
? moment(job.date_estimated) ? dayjs(job.date_estimated)
: null, : null,
}} }}
> >

View File

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

View File

@@ -63,8 +63,8 @@ mutation UNVOID_JOB($jobId: uuid!) {
// created_by: currentUser.email, // created_by: currentUser.email,
// audit: true, // audit: true,
// text: t("jobs.labels.voidnote", { // text: t("jobs.labels.voidnote", {
// date: moment().format("MM/DD/yyy"), // date: dayjs().format("MM/DD/yyy"),
// time: moment().format("hh:mm a"), // 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 { Col, notification, Row } from "antd";
import Axios from "axios"; import Axios from "axios";
import Dinero from "dinero.js"; import Dinero from "dinero.js";
import moment from "moment"; import dayjs from "../../utils/day";
import queryString from "query-string"; import queryString from "query-string";
import React, { useCallback, useEffect, useState } from "react"; import React, { useCallback, useEffect, useState } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
@@ -137,7 +137,7 @@ export function JobsAvailableContainer({
clm_total: Dinero(newTotals.totals.total_repairs).toFormat("0.00"), clm_total: Dinero(newTotals.totals.total_repairs).toFormat("0.00"),
owner_owing: Dinero(newTotals.totals.custPayable.total).toFormat("0.00"), owner_owing: Dinero(newTotals.totals.custPayable.total).toFormat("0.00"),
job_totals: newTotals, job_totals: newTotals,
date_open: moment(), date_open: dayjs(),
status: bodyshop.md_ro_statuses.default_imported, status: bodyshop.md_ro_statuses.default_imported,
notes: { notes: {
data: { data: {

View File

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

View File

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

View File

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

View File

@@ -8,7 +8,7 @@ import {
notification, notification,
} from "antd"; } from "antd";
import axios from "axios"; import axios from "axios";
import moment from "moment"; import dayjs from "../../utils/day";
import React, { useState } from "react"; import React, { useState } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { import {
@@ -64,7 +64,7 @@ const PaymentExpandedRowComponent = ({ record, bodyshop }) => {
payer: record.payer, payer: record.payer,
type: "Refund", type: "Refund",
jobid: payment_response.jobid, jobid: payment_response.jobid,
date: moment(Date.now()), date: dayjs(Date.now()),
}, },
}, },
update(cache, { data }) { 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 ProductionListColumnProductionNote from "../production-list-columns/production-list-columns.productionnote.component";
import ProductionSubletsManageComponent from "../production-sublets-manage/production-sublets-manage.component"; import ProductionSubletsManageComponent from "../production-sublets-manage/production-sublets-manage.component";
import "./production-board-card.styles.scss"; 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 OwnerNameDisplay from "../owner-name-display/owner-name-display.component";
import JobPartsQueueCount from "../job-parts-queue-count/job-parts-queue-count.component"; import JobPartsQueueCount from "../job-parts-queue-count/job-parts-queue-count.component";
@@ -72,11 +72,11 @@ export default function ProductionBoardCard(
const pastDueAlert = const pastDueAlert =
!!card.scheduled_completion && !!card.scheduled_completion &&
((moment().isSameOrAfter(moment(card.scheduled_completion), "day") && ((dayjs().isSameOrAfter(dayjs(card.scheduled_completion), "day") &&
"production-completion-past") || "production-completion-past") ||
(moment() (dayjs()
.add(1, "day") .add(1, "day")
.isSame(moment(card.scheduled_completion), "day") && .isSame(dayjs(card.scheduled_completion), "day") &&
"production-completion-soon")); "production-completion-soon"));
const totalHrs = const totalHrs =

View File

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

View File

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

View File

@@ -1,6 +1,6 @@
import { useMutation } from "@apollo/client"; import { useMutation } from "@apollo/client";
import { Button, Card, Dropdown, Form, Input, notification, Space } from "antd"; 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 React, { useState, useEffect } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { connect } from "react-redux"; import { connect } from "react-redux";
@@ -84,7 +84,7 @@ export function ProductionLastContacted({ currentUser, record }) {
form.setFieldsValue({ form.setFieldsValue({
note: null, note: null,
date_last_contacted: 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]); }, [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 React, { useMemo } from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { createStructuredSelector } from "reselect"; import { createStructuredSelector } from "reselect";
@@ -21,8 +21,8 @@ export function ProductionlistColumnTouchTime({ bodyshop, job }) {
(job.larhrs.aggregate.sum.mod_lb_hrs || 0) + (job.larhrs.aggregate.sum.mod_lb_hrs || 0) +
(job.labhrs.aggregate.sum.mod_lb_hrs || 0); (job.labhrs.aggregate.sum.mod_lb_hrs || 0);
const Difference_In_Days = moment().diff( const Difference_In_Days = dayjs().diff(
moment(job.actual_in), dayjs(job.actual_in),
"days", "days",
true true
); );

View File

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

View File

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

View File

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

View File

@@ -1,28 +1,28 @@
import moment from "moment"; import dayjs from "../../utils/day";
export function getRange(dateParam, viewParam) { export function getRange(dateParam, viewParam) {
let start, end; let start, end;
let date = dateParam || new Date(); let date = dateParam || new Date();
let view = viewParam || "week"; 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") { if (view === "day") {
start = moment(date).startOf("day"); start = dayjs(date).startOf("day");
end = moment(date).endOf("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") { else if (view === "week") {
start = moment(date).startOf("week"); start = dayjs(date).startOf("week");
end = moment(date).endOf("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") { else if (view === "month") {
start = moment(date).startOf("month").subtract(7, "days"); start = dayjs(date).startOf("month").subtract(7, "days");
end = moment(date).endOf("month").add(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") { else if (view === "agenda") {
start = moment(date).startOf("day"); start = dayjs(date).startOf("day");
end = moment(date).endOf("day").add(1, "month"); end = dayjs(date).endOf("day").add(1, "month");
} }
return { start, end }; return { start, end };

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,6 +1,6 @@
import { useApolloClient } from "@apollo/client"; import { useApolloClient } from "@apollo/client";
import { Button } from "antd"; import { Button } from "antd";
import moment from "moment"; import dayjs from "../../utils/day";
import React, { useState } from "react"; import React, { useState } from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { createStructuredSelector } from "reselect"; import { createStructuredSelector } from "reselect";
@@ -27,7 +27,7 @@ export function ScheduleVerifyIntegrity({ currentUser }) {
data: { arrJobs, compJobs, prodJobs }, data: { arrJobs, compJobs, prodJobs },
} = await client.query({ } = await client.query({
query: QUERY_SCHEDULE_LOAD_DATA, 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. //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 { Card } from "antd";
import Dinero from "dinero.js"; import Dinero from "dinero.js";
import _ from "lodash"; import _ from "lodash";
import moment from "moment"; import dayjs from "../../utils/day";
import React from "react"; import React from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { import {
@@ -61,7 +61,7 @@ export function ScoreboardChart({ sbEntriesByDate, bodyshop }) {
} }
const theValue = { const theValue = {
date: moment(val).format("D ddd"), date: dayjs(val).format("D ddd"),
paintHrs: _.round(dayhrs.painthrs, 1), paintHrs: _.round(dayhrs.painthrs, 1),
bodyHrs: _.round(dayhrs.bodyhrs, 1), bodyHrs: _.round(dayhrs.bodyhrs, 1),
accTargetHrs: _.round( accTargetHrs: _.round(

View File

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

View File

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

View File

@@ -2,7 +2,7 @@ import React from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { createStructuredSelector } from "reselect"; import { createStructuredSelector } from "reselect";
import { selectBodyshop } from "../../redux/user/user.selectors"; 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 ScoreboardDayStat from "../scoreboard-day-stats/scoreboard-day-stats.component";
import { Row, Col } from "antd"; import { Row, Col } from "antd";
import LoadingSkeleton from "../loading-skeleton/loading-skeleton.component"; import LoadingSkeleton from "../loading-skeleton/loading-skeleton.component";
@@ -15,11 +15,12 @@ const mapDispatchToProps = (dispatch) => ({
}); });
export function ScoreboardLastDays({ bodyshop, sbEntriesByDate }) { export function ScoreboardLastDays({ bodyshop, sbEntriesByDate }) {
const { lastNumberWorkingDays } = bodyshop.scoreboard_target; const { lastNumberWorkingDays } = bodyshop.scoreboard_target;
const ArrayOfDate = []; const ArrayOfDate = [];
for (var i = lastNumberWorkingDays - 1; i >= 0; i--) { 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 ( return (

View File

@@ -1,7 +1,7 @@
import { CalendarOutlined } from "@ant-design/icons"; import { CalendarOutlined } from "@ant-design/icons";
import { Card, Col, Divider, Row, Statistic } from "antd"; import { Card, Col, Divider, Row, Statistic } from "antd";
import _ from "lodash"; import _ from "lodash";
import moment from "moment"; import dayjs from "../../utils/day";
import React, { useMemo } from "react"; import React, { useMemo } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { connect } from "react-redux"; import { connect } from "react-redux";
@@ -35,7 +35,7 @@ export function ScoreboardTargetsTable({ bodyshop, scoreBoardlist }) {
toDatePaint: 0, toDatePaint: 0,
}; };
const today = moment(); const today = dayjs();
if (dateHash[today.format("YYYY-MM-DD")]) { if (dateHash[today.format("YYYY-MM-DD")]) {
dateHash[today.format("YYYY-MM-DD")].forEach((d) => { dateHash[today.format("YYYY-MM-DD")].forEach((d) => {
ret.todayBody = ret.todayBody + d.bodyhrs; 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)) { while (StartOfWeek.isSameOrBefore(today)) {
if (dateHash[StartOfWeek.format("YYYY-MM-DD")]) { if (dateHash[StartOfWeek.format("YYYY-MM-DD")]) {
dateHash[StartOfWeek.format("YYYY-MM-DD")].forEach((d) => { dateHash[StartOfWeek.format("YYYY-MM-DD")].forEach((d) => {
@@ -54,7 +54,7 @@ export function ScoreboardTargetsTable({ bodyshop, scoreBoardlist }) {
StartOfWeek = StartOfWeek.add(1, "day"); StartOfWeek = StartOfWeek.add(1, "day");
} }
let startOfMonth = moment().startOf("month"); let startOfMonth = dayjs().startOf("month");
while (startOfMonth.isSameOrBefore(today)) { while (startOfMonth.isSameOrBefore(today)) {
if (dateHash[startOfMonth.format("YYYY-MM-DD")]) { if (dateHash[startOfMonth.format("YYYY-MM-DD")]) {
dateHash[startOfMonth.format("YYYY-MM-DD")].forEach((d) => { 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], // workingWeekdays: [1, 2, 3, 4, 5, 6],
// }); // });
export const CalculateWorkingDaysThisMonth = () => { export const CalculateWorkingDaysThisMonth = () => {
return moment().endOf("month").businessDaysIntoMonth(); return dayjs().endOf("month").businessDaysInMonth();
}; };
export const CalculateWorkingDaysInPeriod = (start, end) => { export const CalculateWorkingDaysInPeriod = (start, end) => {
return moment(start).businessDiff(moment(end)); return dayjs(start).businessDiff(dayjs(end));
}; };
export const CalculateWorkingDaysAsOfToday = () => { export const CalculateWorkingDaysAsOfToday = () => {
return moment().businessDaysIntoMonth(); return dayjs().businessDaysInMonth();
}; };
export const CalculateWorkingDaysLastMonth = () => { export const CalculateWorkingDaysLastMonth = () => {
return moment().subtract(1, "month").endOf("month").businessDaysIntoMonth(); return dayjs().subtract(1, "month").endOf("month").businessDaysInMonth();
}; };
export const WeeklyTargetHrs = (dailyTargetHrs, bodyshop) => { export const WeeklyTargetHrs = (dailyTargetHrs, bodyshop) => {
return ( return (
dailyTargetHrs * dailyTargetHrs *
CalculateWorkingDaysInPeriod( CalculateWorkingDaysInPeriod(
moment().startOf("week"), dayjs().startOf("week"),
moment().endOf("week") dayjs().endOf("week")
) )
); );
}; };
@@ -53,20 +53,22 @@ export const AsOfTodayTargetHrs = (dailyTargetHrs, bodyshop) => {
export const AsOfDateTargetHours = (dailyTargetHours, date) => { export const AsOfDateTargetHours = (dailyTargetHours, date) => {
return ( return (
dailyTargetHours * moment().startOf("month").businessDiff(moment(date)) dailyTargetHours * dayjs().startOf("month").businessDiff(dayjs(date))
); );
}; };
export const ListOfBusinessDaysInCurrentMonth = () => { 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")); return momentListOfDays.map((i) => i.format("YYYY-MM-DD"));
}; };
export const ListOfDaysInCurrentMonth = () => { export const ListOfDaysInCurrentMonth = () => {
const days = []; const days = [];
const dateStart = moment().startOf("month"); const dateStart = dayjs().startOf("month");
const dateEnd = moment().endOf("month"); const dateEnd = dayjs().endOf("month");
while (dateEnd.diff(dateStart, "days") > 0) { while (dateEnd.diff(dateStart, "days") > 0) {
days.push(dateStart.format("YYYY-MM-DD")); days.push(dateStart.format("YYYY-MM-DD"));
dateStart.add(1, "days"); dateStart.add(1, "days");
@@ -77,8 +79,8 @@ export const ListOfDaysInCurrentMonth = () => {
export const ListDaysBetween = ({ start, end }) => { export const ListDaysBetween = ({ start, end }) => {
const days = []; const days = [];
const dateStart = moment(start); const dateStart = dayjs(start);
const dateEnd = moment(end); const dateEnd = dayjs(end);
while (dateEnd.diff(dateStart, "days") > 0) { while (dateEnd.diff(dateStart, "days") > 0) {
days.push(dateStart.format("YYYY-MM-DD")); days.push(dateStart.format("YYYY-MM-DD"));
dateStart.add(1, "days"); dateStart.add(1, "days");

View File

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

View File

@@ -8,7 +8,7 @@ import {
Switch, Switch,
Typography, Typography,
} from "antd"; } from "antd";
import moment from "moment"; import dayjs from "../../utils/day";
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { connect } from "react-redux"; import { connect } from "react-redux";
@@ -49,8 +49,8 @@ export function ScoreboardTicketsStats({ data, bodyshop }) {
const statisticWeight = isLarge ? 550 : "normal"; const statisticWeight = isLarge ? 550 : "normal";
const daySpan = const daySpan =
Util.CalculateWorkingDaysInPeriod( Util.CalculateWorkingDaysInPeriod(
moment().startOf("week"), dayjs().startOf("week"),
moment().endOf("week") dayjs().endOf("week")
) > 5 ) > 5
? 3 ? 3
: 4; : 4;
@@ -170,14 +170,14 @@ export function ScoreboardTicketsStats({ data, bodyshop }) {
parseFloat(data.totalThisWeek) >= parseFloat(data.totalThisWeek) >=
Util.WeeklyTargetHrsInPeriod( Util.WeeklyTargetHrsInPeriod(
bodyshop.scoreboard_target.dailyBodyTarget, bodyshop.scoreboard_target.dailyBodyTarget,
moment().startOf("week"), dayjs().startOf("week"),
moment().endOf("week"), dayjs().endOf("week"),
bodyshop bodyshop
) + ) +
Util.WeeklyTargetHrsInPeriod( Util.WeeklyTargetHrsInPeriod(
bodyshop.scoreboard_target.dailyPaintTarget, bodyshop.scoreboard_target.dailyPaintTarget,
moment().startOf("week"), dayjs().startOf("week"),
moment().endOf("week"), dayjs().endOf("week"),
bodyshop bodyshop
) )
? "green" ? "green"
@@ -202,8 +202,8 @@ export function ScoreboardTicketsStats({ data, bodyshop }) {
parseFloat(data.totalThisWeekLAB) >= parseFloat(data.totalThisWeekLAB) >=
Util.WeeklyTargetHrsInPeriod( Util.WeeklyTargetHrsInPeriod(
bodyshop.scoreboard_target.dailyBodyTarget, bodyshop.scoreboard_target.dailyBodyTarget,
moment().startOf("week"), dayjs().startOf("week"),
moment().endOf("week"), dayjs().endOf("week"),
bodyshop bodyshop
) )
? "green" ? "green"
@@ -226,8 +226,8 @@ export function ScoreboardTicketsStats({ data, bodyshop }) {
parseFloat(data.totalThisWeekLAR) >= parseFloat(data.totalThisWeekLAR) >=
Util.WeeklyTargetHrsInPeriod( Util.WeeklyTargetHrsInPeriod(
bodyshop.scoreboard_target.dailyPaintTarget, bodyshop.scoreboard_target.dailyPaintTarget,
moment().startOf("week"), dayjs().startOf("week"),
moment().endOf("week"), dayjs().endOf("week"),
bodyshop bodyshop
) )
? "green" ? "green"
@@ -252,14 +252,14 @@ export function ScoreboardTicketsStats({ data, bodyshop }) {
parseFloat(data.totalLastWeek) >= parseFloat(data.totalLastWeek) >=
Util.WeeklyTargetHrsInPeriod( Util.WeeklyTargetHrsInPeriod(
bodyshop.scoreboard_target.dailyBodyTarget, bodyshop.scoreboard_target.dailyBodyTarget,
moment().subtract(1, "week").startOf("week"), dayjs().subtract(1, "week").startOf("week"),
moment().subtract(1, "week").endOf("week"), dayjs().subtract(1, "week").endOf("week"),
bodyshop bodyshop
) + ) +
Util.WeeklyTargetHrsInPeriod( Util.WeeklyTargetHrsInPeriod(
bodyshop.scoreboard_target.dailyPaintTarget, bodyshop.scoreboard_target.dailyPaintTarget,
moment().subtract(1, "week").startOf("week"), dayjs().subtract(1, "week").startOf("week"),
moment().subtract(1, "week").endOf("week"), dayjs().subtract(1, "week").endOf("week"),
bodyshop bodyshop
) )
? "green" ? "green"
@@ -284,8 +284,8 @@ export function ScoreboardTicketsStats({ data, bodyshop }) {
parseFloat(data.totalLastWeekLAB) >= parseFloat(data.totalLastWeekLAB) >=
Util.WeeklyTargetHrsInPeriod( Util.WeeklyTargetHrsInPeriod(
bodyshop.scoreboard_target.dailyBodyTarget, bodyshop.scoreboard_target.dailyBodyTarget,
moment().subtract(1, "week").startOf("week"), dayjs().subtract(1, "week").startOf("week"),
moment().subtract(1, "week").endOf("week"), dayjs().subtract(1, "week").endOf("week"),
bodyshop bodyshop
) )
? "green" ? "green"
@@ -308,8 +308,8 @@ export function ScoreboardTicketsStats({ data, bodyshop }) {
parseFloat(data.totalLastWeekLAR) >= parseFloat(data.totalLastWeekLAR) >=
Util.WeeklyTargetHrsInPeriod( Util.WeeklyTargetHrsInPeriod(
bodyshop.scoreboard_target.dailyPaintTarget, bodyshop.scoreboard_target.dailyPaintTarget,
moment().subtract(1, "week").startOf("week"), dayjs().subtract(1, "week").startOf("week"),
moment().subtract(1, "week").endOf("week"), dayjs().subtract(1, "week").endOf("week"),
bodyshop bodyshop
) )
? "green" ? "green"
@@ -334,14 +334,14 @@ export function ScoreboardTicketsStats({ data, bodyshop }) {
parseFloat(data.totalPriorWeek) >= parseFloat(data.totalPriorWeek) >=
Util.WeeklyTargetHrsInPeriod( Util.WeeklyTargetHrsInPeriod(
bodyshop.scoreboard_target.dailyBodyTarget, bodyshop.scoreboard_target.dailyBodyTarget,
moment().subtract(2, "week").startOf("week"), dayjs().subtract(2, "week").startOf("week"),
moment().subtract(2, "week").endOf("week"), dayjs().subtract(2, "week").endOf("week"),
bodyshop bodyshop
) + ) +
Util.WeeklyTargetHrsInPeriod( Util.WeeklyTargetHrsInPeriod(
bodyshop.scoreboard_target.dailyPaintTarget, bodyshop.scoreboard_target.dailyPaintTarget,
moment().subtract(2, "week").startOf("week"), dayjs().subtract(2, "week").startOf("week"),
moment().subtract(2, "week").endOf("week"), dayjs().subtract(2, "week").endOf("week"),
bodyshop bodyshop
) )
? "green" ? "green"
@@ -366,8 +366,8 @@ export function ScoreboardTicketsStats({ data, bodyshop }) {
parseFloat(data.totalPriorWeekLAB) >= parseFloat(data.totalPriorWeekLAB) >=
Util.WeeklyTargetHrsInPeriod( Util.WeeklyTargetHrsInPeriod(
bodyshop.scoreboard_target.dailyBodyTarget, bodyshop.scoreboard_target.dailyBodyTarget,
moment().subtract(2, "week").startOf("week"), dayjs().subtract(2, "week").startOf("week"),
moment().subtract(2, "week").endOf("week"), dayjs().subtract(2, "week").endOf("week"),
bodyshop bodyshop
) )
? "green" ? "green"
@@ -390,8 +390,8 @@ export function ScoreboardTicketsStats({ data, bodyshop }) {
parseFloat(data.totalPriorWeekLAR) >= parseFloat(data.totalPriorWeekLAR) >=
Util.WeeklyTargetHrsInPeriod( Util.WeeklyTargetHrsInPeriod(
bodyshop.scoreboard_target.dailyPaintTarget, bodyshop.scoreboard_target.dailyPaintTarget,
moment().subtract(2, "week").startOf("week"), dayjs().subtract(2, "week").startOf("week"),
moment().subtract(2, "week").endOf("week"), dayjs().subtract(2, "week").endOf("week"),
bodyshop bodyshop
) )
? "green" ? "green"

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,6 +1,6 @@
import { useMutation, useQuery } from "@apollo/client"; import { useMutation, useQuery } from "@apollo/client";
import { Form, notification } from "antd"; import { Form, notification } from "antd";
import moment from "moment"; import dayjs from "../../utils/day";
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { logImEXEvent } from "../../firebase/firebase.utils"; import { logImEXEvent } from "../../firebase/firebase.utils";
@@ -58,21 +58,21 @@ export default function ShopInfoContainer() {
accountingconfig: { accountingconfig: {
...data.bodyshops[0].accountingconfig, ...data.bodyshops[0].accountingconfig,
ClosingPeriod: [ ClosingPeriod: [
moment(data.bodyshops[0].accountingconfig.ClosingPeriod[0]), dayjs(data.bodyshops[0].accountingconfig.ClosingPeriod[0]),
moment(data.bodyshops[0].accountingconfig.ClosingPeriod[1]), dayjs(data.bodyshops[0].accountingconfig.ClosingPeriod[1]),
], ],
}, },
schedule_start_time: moment( schedule_start_time: dayjs(
data.bodyshops[0].schedule_start_time 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], ...data.bodyshops[0],
schedule_start_time: moment( schedule_start_time: dayjs(
data.bodyshops[0].schedule_start_time 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 : null
} }

View File

@@ -11,7 +11,6 @@ import {
Space, Space,
Switch, Switch,
} from "antd"; } from "antd";
import momentTZ from "moment-timezone";
import React from "react"; import React from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { connect } from "react-redux"; import { connect } from "react-redux";
@@ -25,7 +24,8 @@ import PhoneFormItem, {
} from "../form-items-formatted/phone-form-item.component"; } from "../form-items-formatted/phone-form-item.component";
import FormListMoveArrows from "../form-list-move-arrows/form-list-move-arrows.component"; import FormListMoveArrows from "../form-list-move-arrows/form-list-move-arrows.component";
import LayoutFormRow from "../layout-form-row/layout-form-row.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({ const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop, bodyshop: selectBodyshop,
}); });

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,7 +1,7 @@
import { useMutation, useQuery } from "@apollo/client"; import { useMutation, useQuery } from "@apollo/client";
import { Button, Form, Modal, Space, notification } from "antd"; import { Button, Form, Modal, Space, notification } from "antd";
import {PageHeader} from "@ant-design/pro-layout"; import {PageHeader} from "@ant-design/pro-layout";
import moment from "moment"; import dayjs from "../../utils/day";
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { connect } from "react-redux"; import { connect } from "react-redux";
@@ -210,7 +210,7 @@ export function TimeTicketModalContainer({
timeTicketModal.context.timeticket.jobid || timeTicketModal.context.timeticket.jobid ||
null, null,
date: timeTicketModal.context.timeticket.date date: timeTicketModal.context.timeticket.date
? moment(timeTicketModal.context.timeticket.date) ? dayjs(timeTicketModal.context.timeticket.date)
: null, : null,
} }
: { jobid: timeTicketModal.context.jobId || null } : { jobid: timeTicketModal.context.jobId || null }

View File

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

View File

@@ -5,7 +5,7 @@ import { useLocation } from "react-router-dom";
import { GenerateDocument } from "../../utils/RenderTemplate"; import { GenerateDocument } from "../../utils/RenderTemplate";
import { TemplateList } from "../../utils/TemplateConstants"; import { TemplateList } from "../../utils/TemplateConstants";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import moment from "moment"; import dayjs from "../../utils/day";
const AttendanceCsv = TemplateList("special").attendance_detail_csv; const AttendanceCsv = TemplateList("special").attendance_detail_csv;
export default function TimeTicketsAttendanceTable() { export default function TimeTicketsAttendanceTable() {
@@ -23,8 +23,8 @@ export default function TimeTicketsAttendanceTable() {
variables: { variables: {
start: start start: start
? start ? start
: moment().startOf("week").subtract(7, "days").format("YYYY-MM-DD"), : dayjs().startOf("week").subtract(7, "days").format("YYYY-MM-DD"),
end: end ? end : moment().endOf("week").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 { GenerateDocument } from "../../utils/RenderTemplate";
import { TemplateList } from "../../utils/TemplateConstants"; import { TemplateList } from "../../utils/TemplateConstants";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import moment from "moment"; import dayjs from "../../utils/day";
const PayrollTemplate = TemplateList("special").exported_payroll; const PayrollTemplate = TemplateList("special").exported_payroll;
export default function TimeTicketsPayrollTable() { export default function TimeTicketsPayrollTable() {
const searchParams = queryString.parse(useLocation().search); const searchParams = queryString.parse(useLocation().search);
@@ -22,8 +22,8 @@ export default function TimeTicketsPayrollTable() {
variables: { variables: {
start: start start: start
? start ? start
: moment().startOf("week").subtract(7, "days").format("YYYY-MM-DD"), : dayjs().startOf("week").subtract(7, "days").format("YYYY-MM-DD"),
end: end ? end : moment().endOf("week").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 { Card, Col, Row, Table } from "antd";
import _ from "lodash"; import _ from "lodash";
import moment from "moment"; import dayjs from "../../utils/day";
import React, { useMemo, useState } from "react"; import React, { useMemo, useState } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { connect } from "react-redux"; import { connect } from "react-redux";
@@ -124,7 +124,7 @@ const JobRelatedTicketsTable = ({
if (!!val.clockoff && !!val.clockon) if (!!val.clockoff && !!val.clockon)
return ( return (
acc + acc +
moment(val.clockoff).diff(moment(val.clockon), "hours", true) dayjs(val.clockoff).diff(dayjs(val.clockon), "hours", true)
); );
return acc; return acc;
}, 0); }, 0);
@@ -251,7 +251,7 @@ const ShiftRelatedTicketsTable = ({
const clockHrs = item.tickets.reduce((acc, val) => { const clockHrs = item.tickets.reduce((acc, val) => {
if (!!val.clockoff && !!val.clockon) if (!!val.clockoff && !!val.clockon)
return ( return (
acc + moment(val.clockoff).diff(moment(val.clockon), "hours", true) acc + dayjs(val.clockoff).diff(dayjs(val.clockon), "hours", true)
); );
return acc; return acc;
}, 0); }, 0);

View File

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

View File

@@ -1,6 +1,6 @@
import { useMutation, useQuery } from "@apollo/client"; import { useMutation, useQuery } from "@apollo/client";
import { Form, notification } from "antd"; import { Form, notification } from "antd";
import moment from "moment"; import dayjs from "../../utils/day";
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { connect } from "react-redux"; import { connect } from "react-redux";
@@ -139,19 +139,19 @@ export function ContractDetailPageContainer({
initialValues={{ initialValues={{
...data.cccontracts_by_pk, ...data.cccontracts_by_pk,
start: data.cccontracts_by_pk.start start: data.cccontracts_by_pk.start
? moment(data.cccontracts_by_pk.start) ? dayjs(data.cccontracts_by_pk.start)
: null, : null,
scheduledreturn: data.cccontracts_by_pk.scheduledreturn scheduledreturn: data.cccontracts_by_pk.scheduledreturn
? moment(data.cccontracts_by_pk.scheduledreturn) ? dayjs(data.cccontracts_by_pk.scheduledreturn)
: null, : null,
actualreturn: data.cccontracts_by_pk.actualreturn actualreturn: data.cccontracts_by_pk.actualreturn
? moment(data.cccontracts_by_pk.actualreturn) ? dayjs(data.cccontracts_by_pk.actualreturn)
: null, : null,
driver_dlexpiry: data.cccontracts_by_pk.driver_dlexpiry driver_dlexpiry: data.cccontracts_by_pk.driver_dlexpiry
? moment(data.cccontracts_by_pk.driver_dlexpiry) ? dayjs(data.cccontracts_by_pk.driver_dlexpiry)
: null, : null,
driver_dob: data.cccontracts_by_pk.driver_dob driver_dob: data.cccontracts_by_pk.driver_dob
? moment(data.cccontracts_by_pk.driver_dob) ? dayjs(data.cccontracts_by_pk.driver_dob)
: null, : null,
}} }}
> >

View File

@@ -1,6 +1,6 @@
import { useMutation, useQuery } from "@apollo/client"; import { useMutation, useQuery } from "@apollo/client";
import { Form, notification } from "antd"; import { Form, notification } from "antd";
import moment from "moment"; import dayjs from "../../utils/day";
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { connect } from "react-redux"; import { connect } from "react-redux";
@@ -154,25 +154,25 @@ export function CourtesyCarDetailPageContainer({
? { ? {
...data.courtesycars_by_pk, ...data.courtesycars_by_pk,
purchasedate: data.courtesycars_by_pk.purchasedate purchasedate: data.courtesycars_by_pk.purchasedate
? moment(data.courtesycars_by_pk.purchasedate) ? dayjs(data.courtesycars_by_pk.purchasedate)
: null, : null,
servicestartdate: data.courtesycars_by_pk.servicestartdate servicestartdate: data.courtesycars_by_pk.servicestartdate
? moment(data.courtesycars_by_pk.servicestartdate) ? dayjs(data.courtesycars_by_pk.servicestartdate)
: null, : null,
serviceenddate: data.courtesycars_by_pk.serviceenddate serviceenddate: data.courtesycars_by_pk.serviceenddate
? moment(data.courtesycars_by_pk.serviceenddate) ? dayjs(data.courtesycars_by_pk.serviceenddate)
: null, : null,
leaseenddate: data.courtesycars_by_pk.leaseenddate leaseenddate: data.courtesycars_by_pk.leaseenddate
? moment(data.courtesycars_by_pk.leaseenddate) ? dayjs(data.courtesycars_by_pk.leaseenddate)
: null, : null,
nextservicedate: data.courtesycars_by_pk.nextservicedate nextservicedate: data.courtesycars_by_pk.nextservicedate
? moment(data.courtesycars_by_pk.nextservicedate) ? dayjs(data.courtesycars_by_pk.nextservicedate)
: null, : null,
registrationexpires: data.courtesycars_by_pk.registrationexpires registrationexpires: data.courtesycars_by_pk.registrationexpires
? moment(data.courtesycars_by_pk.registrationexpires) ? dayjs(data.courtesycars_by_pk.registrationexpires)
: null, : null,
insuranceexpires: data.courtesycars_by_pk.insuranceexpires insuranceexpires: data.courtesycars_by_pk.insuranceexpires
? moment(data.courtesycars_by_pk.insuranceexpires) ? dayjs(data.courtesycars_by_pk.insuranceexpires)
: null, : null,
} }
: {} : {}

View File

@@ -1,6 +1,6 @@
import { useQuery } from "@apollo/client"; import { useQuery } from "@apollo/client";
import { Col, Row, Typography } from "antd"; import { Col, Row, Typography } from "antd";
import moment from "moment"; import dayjs from "../../utils/day";
import React, { useEffect } from "react"; import React, { useEffect } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { connect } from "react-redux"; import { connect } from "react-redux";
@@ -66,7 +66,7 @@ export function JobsChecklistViewContainer({
<div> <div>
{t("jobs.labels.checklistcompletedby", { {t("jobs.labels.checklistcompletedby", {
by: checklist.completed_by, 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>
</div> </div>

View File

@@ -25,7 +25,7 @@ import { connect } from "react-redux";
// import { useNavigate } from 'react-router-dom'; // import { useNavigate } from 'react-router-dom';
import { useTreatments } from "@splitsoftware/splitio-react"; import { useTreatments } from "@splitsoftware/splitio-react";
import Dinero from "dinero.js"; import Dinero from "dinero.js";
import moment from "moment"; import dayjs from "../../utils/day";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import { createStructuredSelector } from "reselect"; import { createStructuredSelector } from "reselect";
import DateTimePicker from "../../components/form-date-time-picker/form-date-time-picker.component"; import DateTimePicker from "../../components/form-date-time-picker/form-date-time-picker.component";
@@ -137,17 +137,17 @@ export function JobsCloseComponent({ job, bodyshop, jobRO }) {
initialValues={{ initialValues={{
joblines: job.joblines, joblines: job.joblines,
actual_in: job.actual_in actual_in: job.actual_in
? moment(job.actual_in) ? dayjs(job.actual_in)
: job.scheduled_in && moment(job.scheduled_in), : job.scheduled_in && dayjs(job.scheduled_in),
actual_completion: job.actual_completion actual_completion: job.actual_completion
? moment(job.actual_completion) ? dayjs(job.actual_completion)
: job.scheduled_completion && moment(job.scheduled_completion), : job.scheduled_completion && dayjs(job.scheduled_completion),
actual_delivery: job.actual_delivery actual_delivery: job.actual_delivery
? moment(job.actual_delivery) ? dayjs(job.actual_delivery)
: job.scheduled_delivery && moment(job.scheduled_delivery), : job.scheduled_delivery && dayjs(job.scheduled_delivery),
date_invoiced: job.date_invoiced date_invoiced: job.date_invoiced
? moment(job.date_invoiced) ? dayjs(job.date_invoiced)
: moment(), : dayjs(),
kmin: job.kmin, kmin: job.kmin,
kmout: job.kmout, kmout: job.kmout,
dms_allocation: job.dms_allocation, dms_allocation: job.dms_allocation,
@@ -259,7 +259,7 @@ export function JobsCloseComponent({ job, bodyshop, jobRO }) {
({ getFieldValue }) => ({ ({ getFieldValue }) => ({
validator(_, value) { validator(_, value) {
if (!bodyshop.cdk_dealerid) return Promise.resolve(); 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.resolve();
} }
return Promise.reject( return Promise.reject(
@@ -274,13 +274,13 @@ export function JobsCloseComponent({ job, bodyshop, jobRO }) {
bodyshop.accountingconfig.ClosingPeriod bodyshop.accountingconfig.ClosingPeriod
) { ) {
if ( if (
moment(value).isSameOrAfter( dayjs(value).isSameOrAfter(
moment( dayjs(
bodyshop.accountingconfig.ClosingPeriod[0] bodyshop.accountingconfig.ClosingPeriod[0]
).startOf("day") ).startOf("day")
) && ) &&
moment(value).isSameOrBefore( dayjs(value).isSameOrBefore(
moment( dayjs(
bodyshop.accountingconfig.ClosingPeriod[1] bodyshop.accountingconfig.ClosingPeriod[1]
).endOf("day") ).endOf("day")
) )

View File

@@ -19,7 +19,7 @@ import {
import {PageHeader} from "@ant-design/pro-layout"; import {PageHeader} from "@ant-design/pro-layout";
import Axios from "axios"; import Axios from "axios";
import moment from "moment"; import dayjs from "../../utils/day";
import queryString from "query-string"; import queryString from "query-string";
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
@@ -172,7 +172,7 @@ export function JobsDetailPage({
jobid: job.id, jobid: job.id,
operation: AuditTrailMapping.jobfieldchange( operation: AuditTrailMapping.jobfieldchange(
key, key,
changedAuditFields[key] instanceof moment changedAuditFields[key] instanceof dayjs
? DateTimeFormat(changedAuditFields[key]) ? DateTimeFormat(changedAuditFields[key])
: changedAuditFields[key] : changedAuditFields[key]
), ),
@@ -392,7 +392,7 @@ export default connect(mapStateToProps, mapDispatchToProps)(JobsDetailPage);
const transormJobToForm = (job) => { const transormJobToForm = (job) => {
return { return {
...job, ...job,
loss_date: job.loss_date ? moment(job.loss_date) : null, loss_date: job.loss_date ? dayjs(job.loss_date) : null,
date_estimated: job.date_estimated ? moment(job.date_estimated) : null, date_estimated: job.date_estimated ? dayjs(job.date_estimated) : null,
}; };
}; };

View File

@@ -1,6 +1,6 @@
import { useQuery } from "@apollo/client"; import { useQuery } from "@apollo/client";
import { Col, Row, Space } from "antd"; import { Col, Row, Space } from "antd";
import moment from "moment"; import dayjs from "../../utils/day";
import React, { useEffect } from "react"; import React, { useEffect } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { connect } from "react-redux"; import { connect } from "react-redux";
@@ -36,9 +36,9 @@ export function TimeTicketsContainer({
const { start, end } = Object.fromEntries(searchParams); const { start, end } = Object.fromEntries(searchParams);
const startDate = start const startDate = start
? moment(start) ? dayjs(start)
: moment().startOf("week").subtract(7, "days"); : dayjs().startOf("week").subtract(7, "days");
const endDate = end ? moment(end) : moment().endOf("week"); const endDate = end ? dayjs(end) : dayjs().endOf("week");
const { loading, error, data } = useQuery(QUERY_TIME_TICKETS_IN_RANGE, { const { loading, error, data } = useQuery(QUERY_TIME_TICKETS_IN_RANGE, {
variables: { 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 { all, call, put, select, takeLatest } from "redux-saga/effects";
import { QUERY_SCHEDULE_LOAD_DATA } from "../../graphql/appointments.queries"; import { QUERY_SCHEDULE_LOAD_DATA } from "../../graphql/appointments.queries";
import { INSERT_AUDIT_TRAIL } from "../../graphql/audit_trail.queries"; import { INSERT_AUDIT_TRAIL } from "../../graphql/audit_trail.queries";
@@ -18,8 +18,8 @@ export function* onCalculateScheduleLoad() {
); );
} }
export function* calculateScheduleLoad({ payload: end }) { export function* calculateScheduleLoad({ payload: end }) {
//REMINDER: Moment.js is not immutable. Today WILL change when adjusted. //REMINDER: dayjs.js is not immutable. Today WILL change when adjusted.
const today = moment().startOf("day"); const today = dayjs().startOf("day");
const state = yield select(); const state = yield select();
const buckets = state.user.bodyshop.ssbuckets; 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. //Add all of the jobs currently in production to the buckets so that we have a starting point.
if ( if (
!item.actual_completion && !item.actual_completion &&
moment(item.scheduled_completion).isBefore(moment().startOf("day")) dayjs(item.scheduled_completion).isBefore(dayjs().startOf("day"))
) { ) {
problemJobs.push({ problemJobs.push({
...item, ...item,
@@ -57,7 +57,7 @@ export function* calculateScheduleLoad({ payload: end }) {
if ( if (
item.actual_completion && item.actual_completion &&
moment(item.actual_completion).isBefore(moment().startOf("day")) dayjs(item.actual_completion).isBefore(dayjs().startOf("day"))
) { ) {
problemJobs.push({ problemJobs.push({
...item, ...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", 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({ problemJobs.push({
...item, ...item,
code: "Job has an actual in date set in the future", code: "Job has an actual in date set in the future",
@@ -106,7 +106,7 @@ export function* calculateScheduleLoad({ payload: end }) {
} }
if ( if (
item.actual_completion && item.actual_completion &&
moment(item.actual_completion).isAfter(moment()) dayjs(item.actual_completion).isAfter(dayjs())
) { ) {
problemJobs.push({ problemJobs.push({
...item, ...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" "yyyy-MM-DD"
); );
@@ -169,7 +169,7 @@ export function* calculateScheduleLoad({ payload: end }) {
const AddJobForSchedulingCalc = inProdJobs || inArrJobs; const AddJobForSchedulingCalc = inProdJobs || inArrJobs;
const itemDate = moment( const itemDate = dayjs(
item.actual_completion || item.scheduled_completion item.actual_completion || item.scheduled_completion
).format("yyyy-MM-DD"); ).format("yyyy-MM-DD");
//Skip it, it's already completed. //Skip it, it's already completed.
@@ -207,10 +207,10 @@ export function* calculateScheduleLoad({ payload: end }) {
//Propagate the expected load to each day. //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++) { for (var day = 0; day < range; day++) {
const current = moment(today).add(day, "days").format("yyyy-MM-DD"); const current = dayjs(today).add(day, "days").format("yyyy-MM-DD");
const prev = moment(today) const prev = dayjs(today)
.add(day - 1, "days") .add(day - 1, "days")
.format("yyyy-MM-DD"); .format("yyyy-MM-DD");
if (!!!load[current]) { if (!!!load[current]) {

View File

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

View File

@@ -1,10 +1,10 @@
import { Tooltip } from "antd"; import { Tooltip } from "antd";
import moment from "moment"; import dayjs from "../utils/day";
import React from "react"; import React from "react";
export function DateFormatter(props) { export function DateFormatter(props) {
return props.children return props.children
? moment(props.children).format( ? dayjs(props.children).format(
props.includeDay ? "ddd MM/DD/YYYY" : "MM/DD/YYYY" props.includeDay ? "ddd MM/DD/YYYY" : "MM/DD/YYYY"
) )
: null; : null;
@@ -12,19 +12,19 @@ export function DateFormatter(props) {
export function DateTimeFormatter(props) { export function DateTimeFormatter(props) {
return props.children return props.children
? moment(props.children).format( ? dayjs(props.children).format(
props.format ? props.format : "MM/DD/YYYY hh:mm a" props.format ? props.format : "MM/DD/YYYY hh:mm a"
) )
: null; : null;
} }
export function TimeFormatter(props) { export function TimeFormatter(props) {
return props.children 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; : null;
} }
export function TimeAgoFormatter(props) { export function TimeAgoFormatter(props) {
const m = moment(props.children); const m = dayjs(props.children);
return props.children ? ( return props.children ? (
<Tooltip placement="top" title={m.format("MM/DD/YYY hh:mm A")}> <Tooltip placement="top" title={m.format("MM/DD/YYY hh:mm A")}>
{m.fromNow()} {m.fromNow()}
@@ -33,5 +33,5 @@ export function TimeAgoFormatter(props) {
} }
export function DateTimeFormat(value) { 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 = { const range = {
Today: [moment(), moment()], Today: [dayjs(), dayjs()],
"Last 14 days": [moment().subtract(14, "days"), moment()], "Last 14 days": [dayjs().subtract(14, "days"), dayjs()],
"Last 7 days": [moment().subtract(7, "days"), moment()], "Last 7 days": [dayjs().subtract(7, "days"), dayjs()],
"Next 7 days": [moment(), moment().add(7, "days")], "Next 7 days": [dayjs(), dayjs().add(7, "days")],
"Next 14 days": [moment(), moment().add(14, "days")], "Next 14 days": [dayjs(), dayjs().add(14, "days")],
"Last Month": [ "Last Month": [
moment().startOf("month").subtract(1, "month"), dayjs().startOf("month").subtract(1, "month"),
moment().startOf("month").subtract(1, "month").endOf("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": [ "Next Month": [
moment().startOf("month").add(1, "month"), dayjs().startOf("month").add(1, "month"),
moment().startOf("month").add(1, "month").endOf("month"), dayjs().startOf("month").add(1, "month").endOf("month"),
], ],
"Last Quarter": [ "Last Quarter": [
moment().startOf("quarter").subtract(1, "quarters"), dayjs().startOf("quarter").subtract(1, "quarters"),
moment().startOf("quarter").subtract(1, "day"), dayjs().startOf("quarter").subtract(1, "day"),
], ],
"This Quarter": [ "This Quarter": [
moment().startOf("quarter"), dayjs().startOf("quarter"),
moment().startOf("quarter").add(1, "quarter").subtract(1, "day"), 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; export default range;

View File

@@ -73,7 +73,7 @@ export default async function RenderTemplate(
headerpath: `/${bodyshop.imexshopid}/header.html`, headerpath: `/${bodyshop.imexshopid}/header.html`,
footerpath: `/${bodyshop.imexshopid}/footer.html`, footerpath: `/${bodyshop.imexshopid}/footer.html`,
bodyshop: bodyshop, 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;