Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/utils/utils.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* global jQuery */
import _ from 'lodash';
import moment from 'moment-timezone/moment-timezone';
import jtz from 'jstimezonedetect';
import dompurify from 'dompurify';
import dayjs from "dayjs";
Expand Down Expand Up @@ -135,10 +134,10 @@
* @returns {boolean} - TRUE if the condition is true; FALSE otherwise.
*/

/**

Check warning on line 137 in src/utils/utils.js

View workflow job for this annotation

GitHub Actions / setup

Missing JSDoc @returns declaration
*
* @param conditionPaths

Check warning on line 139 in src/utils/utils.js

View workflow job for this annotation

GitHub Actions / setup

Missing JSDoc @param "conditionPaths" description

Check warning on line 139 in src/utils/utils.js

View workflow job for this annotation

GitHub Actions / setup

Missing JSDoc @param "conditionPaths" type
* @param data

Check warning on line 140 in src/utils/utils.js

View workflow job for this annotation

GitHub Actions / setup

Missing JSDoc @param "data" description

Check warning on line 140 in src/utils/utils.js

View workflow job for this annotation

GitHub Actions / setup

Missing JSDoc @param "data" type
*/
function getConditionalPathsRecursive(conditionPaths, data) {
let currentGlobalIndex = 0;
Expand Down Expand Up @@ -185,9 +184,9 @@
return conditionalPathsArray;
}

/**

Check warning on line 187 in src/utils/utils.js

View workflow job for this annotation

GitHub Actions / setup

Missing JSDoc @returns declaration
*
* @param component

Check warning on line 189 in src/utils/utils.js

View workflow job for this annotation

GitHub Actions / setup

Missing JSDoc @param "component" description

Check warning on line 189 in src/utils/utils.js

View workflow job for this annotation

GitHub Actions / setup

Missing JSDoc @param "component" type
* @param condition
* @param row
* @param data
Expand Down Expand Up @@ -563,14 +562,14 @@
return date.isValid() ? date.toDate() : null;
}

let dateSetting = ((typeof date !== 'string') || (date.indexOf('moment(') === -1)) ? moment(date) : null;
let dateSetting = ((typeof date !== 'string') || (date.indexOf('dayjs(') === -1)) ? dayjs(date) : null;
if (dateSetting && dateSetting.isValid()) {
return dateSetting.toDate();
}

dateSetting = null;
try {
const value = Evaluator.evaluator(`return ${date};`, 'moment')(moment);
const value = Evaluator.evaluator(`return ${date};`, 'dayjs')(dayjs);
if (typeof value === 'string') {
dateSetting = dayjs(value);
}
Expand Down Expand Up @@ -638,6 +637,15 @@
};
}

/**
* Returns if the zones are loaded.
* (This is legacy. The only reason why we need to keep this is to not break customers who may be using zonesLoaded)
* @returns {boolean} - TRUE if the zones are loaded; FALSE otherwise.
*/
export function zonesLoaded() {
return true
}

/**
* Returns if we should handle a timezone difference.
* @param {string} timezone - The timezone to check if we should load the zones.
Expand Down
Loading