Skip to content

Commit

Permalink
FIO-8541: replaced moment.js by day.js
Browse files Browse the repository at this point in the history
  • Loading branch information
KatrinKhilko committed Dec 9, 2024
1 parent c7ac015 commit 2792d73
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 17 deletions.
6 changes: 0 additions & 6 deletions config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ module.exports = {
arrowFunction: false,
},
},
plugins: [
new webpack.IgnorePlugin({
resourceRegExp: /^\.\/locale$/,
contextRegExp: /moment$/,
}),
],
resolve: {
extensions: ['.ts', '.js'],
plugins: [
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,7 @@
"fetch-ponyfill": "^7.1.0",
"inputmask": "5.0.9",
"json-logic-js": "^2.0.5",
"lodash": "^4.17.21",
"moment": "^2.29.4"
"lodash": "^4.17.21"
},
"nyc": {
"check-coverage": true,
Expand Down
17 changes: 13 additions & 4 deletions src/utils/operators/DateGreaterThan.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
import ConditionOperator from './ConditionOperator';
import moment from 'moment';
import dayjs from 'dayjs';
import utc from 'dayjs/plugin/utc';
import timezone from 'dayjs/plugin/timezone';
import customParseFormat from 'dayjs/plugin/customParseFormat';
import advancedFormat from 'dayjs/plugin/advancedFormat';
import { isPartialDay, getDateValidationFormat } from '../../utils/date';

dayjs.extend(utc);
dayjs.extend(timezone);
dayjs.extend(customParseFormat);
dayjs.extend(advancedFormat);
export default class DateGeaterThan extends ConditionOperator {
static get operatorKey() {
return 'dateGreaterThan';
Expand All @@ -15,10 +24,10 @@ export default class DateGeaterThan extends ConditionOperator {
conditionTriggerComponent && conditionTriggerComponent.component.type === 'day'
? getDateValidationFormat(conditionTriggerComponent.component)
: null;
const date = validationFormat ? moment(value, validationFormat) : moment(value);
const date = validationFormat ? dayjs(value, validationFormat) : dayjs(value);
const comparedDate = validationFormat
? moment(comparedValue, validationFormat)
: moment(comparedValue);
? dayjs(comparedValue, validationFormat)
: dayjs(comparedValue);

return { date, comparedDate };
}
Expand Down
5 changes: 0 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3735,11 +3735,6 @@ mock-local-storage@^1.1.20:
core-js "^3.30.2"
global "^4.3.2"

moment@^2.29.4:
version "2.30.1"
resolved "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz#f8c91c07b7a786e30c59926df530b4eac96974ae"
integrity sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==

[email protected]:
version "2.1.2"
resolved "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz"
Expand Down

0 comments on commit 2792d73

Please sign in to comment.