@qrvey/utils 1.10.0-3 → 1.10.0-4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/dates/helpers/getTimezoneObject.d.ts +1 -1
- package/dist/cjs/dates/helpers/getTimezoneObject.js +8 -1
- package/dist/cjs/dates/helpers/getUTCFormatByOffset.js +1 -3
- package/dist/cjs/dates/interfaces/IDTimezone.d.ts +1 -0
- package/dist/cjs/globalization/labels/filters/I18N_RELATIVE_CONTAINER.js +1 -1
- package/dist/dates/helpers/getTimezoneObject.d.ts +1 -1
- package/dist/dates/helpers/getTimezoneObject.js +8 -1
- package/dist/dates/helpers/getUTCFormatByOffset.js +1 -3
- package/dist/dates/interfaces/IDTimezone.d.ts +1 -0
- package/dist/globalization/labels/filters/I18N_RELATIVE_CONTAINER.js +1 -1
- package/package.json +1 -1
|
@@ -7,4 +7,4 @@ import { IDTimezone } from "../interfaces/IDTimezone";
|
|
|
7
7
|
* @param {IModel | IDataset} model the info of the dataset (model)
|
|
8
8
|
* @returns a new timezone object
|
|
9
9
|
*/
|
|
10
|
-
export declare function getTimezoneObject(timezone: IDTimezone, model
|
|
10
|
+
export declare function getTimezoneObject(timezone: IDTimezone, model?: IModel | IDataset): IDTimezone;
|
|
@@ -4,6 +4,7 @@ exports.getTimezoneObject = void 0;
|
|
|
4
4
|
const isEmpty_1 = require("../../general/mix/isEmpty");
|
|
5
5
|
const TIMEZONE_TYPE_1 = require("../constants/TIMEZONE_TYPE");
|
|
6
6
|
const getTimezoneOffsetByType_1 = require("./getTimezoneOffsetByType");
|
|
7
|
+
const getUTCFormatByOffset_1 = require("./getUTCFormatByOffset");
|
|
7
8
|
const isValidISOOffset_1 = require("./isValidISOOffset");
|
|
8
9
|
/**
|
|
9
10
|
* Gets the timezone object by the given argument or the model object
|
|
@@ -14,9 +15,12 @@ const isValidISOOffset_1 = require("./isValidISOOffset");
|
|
|
14
15
|
function getTimezoneObject(timezone, model) {
|
|
15
16
|
const offset = getOffset(timezone, model);
|
|
16
17
|
const type = getType(timezone, model, offset);
|
|
18
|
+
const resultingOffset = (0, getTimezoneOffsetByType_1.getTimezoneOffsetByType)({ offset, type });
|
|
19
|
+
const utc = getUTC({ offset: resultingOffset, type });
|
|
17
20
|
return {
|
|
18
|
-
offset:
|
|
21
|
+
offset: resultingOffset,
|
|
19
22
|
type,
|
|
23
|
+
utc,
|
|
20
24
|
};
|
|
21
25
|
}
|
|
22
26
|
exports.getTimezoneObject = getTimezoneObject;
|
|
@@ -60,3 +64,6 @@ function getTypeByOffset(offset) {
|
|
|
60
64
|
}
|
|
61
65
|
return TIMEZONE_TYPE_1.TIMEZONE_TYPE.DEFAULT;
|
|
62
66
|
}
|
|
67
|
+
function getUTC(timezone) {
|
|
68
|
+
return (0, getUTCFormatByOffset_1.getUTCFormatByOffset)(timezone);
|
|
69
|
+
}
|
|
@@ -2,15 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getUTCFormatByOffset = void 0;
|
|
4
4
|
const numericOffsetToISO_1 = require("../adapters/numericOffsetToISO");
|
|
5
|
-
const getTimezoneObject_1 = require("./getTimezoneObject");
|
|
6
5
|
/**
|
|
7
6
|
* Gets the UTC format dependeing on the given offset
|
|
8
7
|
* @param {IDTimezone} timezone the timezone object
|
|
9
8
|
* @returns {string} an string with the UTC format
|
|
10
9
|
*/
|
|
11
10
|
function getUTCFormatByOffset(timezone) {
|
|
12
|
-
|
|
13
|
-
let newOffset = (0, numericOffsetToISO_1.numericOffsetToISO)(newTimezone === null || newTimezone === void 0 ? void 0 : newTimezone.offset, false);
|
|
11
|
+
let newOffset = (0, numericOffsetToISO_1.numericOffsetToISO)(timezone === null || timezone === void 0 ? void 0 : timezone.offset, false);
|
|
14
12
|
if (newOffset.search(":0") > -1) {
|
|
15
13
|
newOffset = newOffset.slice(0, newOffset.indexOf(":"));
|
|
16
14
|
}
|
|
@@ -13,5 +13,5 @@ exports.I18N_RELATIVE_CONTAINER = {
|
|
|
13
13
|
starting_date_tooltip: "The relative date will include the specific starting date and a period of time to show from that date onwards (Inclusive range). <br/> Unchecking this option will exclude the chosen starting date (exclusive range) from the date range.",
|
|
14
14
|
starting_from: "Starting From",
|
|
15
15
|
set_current_date: "Set to current date",
|
|
16
|
-
utc_tooltip: "The times displayed are in
|
|
16
|
+
utc_tooltip: "The times displayed are in {{utc}}",
|
|
17
17
|
};
|
|
@@ -7,4 +7,4 @@ import { IDTimezone } from "../interfaces/IDTimezone";
|
|
|
7
7
|
* @param {IModel | IDataset} model the info of the dataset (model)
|
|
8
8
|
* @returns a new timezone object
|
|
9
9
|
*/
|
|
10
|
-
export declare function getTimezoneObject(timezone: IDTimezone, model
|
|
10
|
+
export declare function getTimezoneObject(timezone: IDTimezone, model?: IModel | IDataset): IDTimezone;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { isEmpty } from "../../general/mix/isEmpty";
|
|
2
2
|
import { TIMEZONE_TYPE } from "../constants/TIMEZONE_TYPE";
|
|
3
3
|
import { getTimezoneOffsetByType } from "./getTimezoneOffsetByType";
|
|
4
|
+
import { getUTCFormatByOffset } from "./getUTCFormatByOffset";
|
|
4
5
|
import { isValidISOOffset } from "./isValidISOOffset";
|
|
5
6
|
/**
|
|
6
7
|
* Gets the timezone object by the given argument or the model object
|
|
@@ -11,9 +12,12 @@ import { isValidISOOffset } from "./isValidISOOffset";
|
|
|
11
12
|
export function getTimezoneObject(timezone, model) {
|
|
12
13
|
const offset = getOffset(timezone, model);
|
|
13
14
|
const type = getType(timezone, model, offset);
|
|
15
|
+
const resultingOffset = getTimezoneOffsetByType({ offset, type });
|
|
16
|
+
const utc = getUTC({ offset: resultingOffset, type });
|
|
14
17
|
return {
|
|
15
|
-
offset:
|
|
18
|
+
offset: resultingOffset,
|
|
16
19
|
type,
|
|
20
|
+
utc,
|
|
17
21
|
};
|
|
18
22
|
}
|
|
19
23
|
function getOffset(timezone, model) {
|
|
@@ -56,3 +60,6 @@ function getTypeByOffset(offset) {
|
|
|
56
60
|
}
|
|
57
61
|
return TIMEZONE_TYPE.DEFAULT;
|
|
58
62
|
}
|
|
63
|
+
function getUTC(timezone) {
|
|
64
|
+
return getUTCFormatByOffset(timezone);
|
|
65
|
+
}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { numericOffsetToISO } from "../adapters/numericOffsetToISO";
|
|
2
|
-
import { getTimezoneObject } from "./getTimezoneObject";
|
|
3
2
|
/**
|
|
4
3
|
* Gets the UTC format dependeing on the given offset
|
|
5
4
|
* @param {IDTimezone} timezone the timezone object
|
|
6
5
|
* @returns {string} an string with the UTC format
|
|
7
6
|
*/
|
|
8
7
|
export function getUTCFormatByOffset(timezone) {
|
|
9
|
-
|
|
10
|
-
let newOffset = numericOffsetToISO(newTimezone === null || newTimezone === void 0 ? void 0 : newTimezone.offset, false);
|
|
8
|
+
let newOffset = numericOffsetToISO(timezone === null || timezone === void 0 ? void 0 : timezone.offset, false);
|
|
11
9
|
if (newOffset.search(":0") > -1) {
|
|
12
10
|
newOffset = newOffset.slice(0, newOffset.indexOf(":"));
|
|
13
11
|
}
|
|
@@ -10,5 +10,5 @@ export const I18N_RELATIVE_CONTAINER = {
|
|
|
10
10
|
starting_date_tooltip: "The relative date will include the specific starting date and a period of time to show from that date onwards (Inclusive range). <br/> Unchecking this option will exclude the chosen starting date (exclusive range) from the date range.",
|
|
11
11
|
starting_from: "Starting From",
|
|
12
12
|
set_current_date: "Set to current date",
|
|
13
|
-
utc_tooltip: "The times displayed are in
|
|
13
|
+
utc_tooltip: "The times displayed are in {{utc}}",
|
|
14
14
|
};
|