@qrvey/utils 1.6.0-5 → 1.6.0-7
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/constants/DATETIME_COLUMN_FORMAT.js +1 -9
- package/dist/cjs/format/helpers/index.d.ts +1 -0
- package/dist/cjs/format/helpers/index.js +17 -0
- package/dist/cjs/format/helpers/isDateTimeFormat.d.ts +7 -0
- package/dist/cjs/format/helpers/isDateTimeFormat.js +17 -0
- package/dist/cjs/format/index.d.ts +1 -0
- package/dist/cjs/format/index.js +1 -0
- package/dist/cjs/format/localization.js +2 -3
- package/dist/dates/constants/DATETIME_COLUMN_FORMAT.js +1 -9
- package/dist/format/helpers/index.d.ts +1 -0
- package/dist/format/helpers/index.js +1 -0
- package/dist/format/helpers/isDateTimeFormat.d.ts +7 -0
- package/dist/format/helpers/isDateTimeFormat.js +13 -0
- package/dist/format/index.d.ts +1 -0
- package/dist/format/index.js +1 -0
- package/dist/format/localization.js +2 -3
- package/package.json +1 -1
|
@@ -1,12 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DATETIME_COLUMN_FORMAT = void 0;
|
|
4
|
-
exports.DATETIME_COLUMN_FORMAT = [
|
|
5
|
-
"MM/DD/YYYY HH24:MM:SS",
|
|
6
|
-
"DD/MM/YYYY HH24:MM:SS",
|
|
7
|
-
"YYYY-MM-DD HH24:MM:SS",
|
|
8
|
-
"MM/DD/YYYY HH24:MI:SS",
|
|
9
|
-
"DD/MM/YYYY HH24:MI:SS",
|
|
10
|
-
"YYYY-MM-DD HH24:MI:SS",
|
|
11
|
-
"YYYY-MM-DD HH:mm:ss",
|
|
12
|
-
];
|
|
4
|
+
exports.DATETIME_COLUMN_FORMAT = ["HH24:MM:SS", "HH24:MI:SS", "HH:mm:ss"];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./isDateTimeFormat";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./isDateTimeFormat"), exports);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IFormatOutputFormat } from "../../interfaces/format/IFormatOutputFormat.Interface";
|
|
2
|
+
/**
|
|
3
|
+
* It checks if the outputFormat is a date time format.
|
|
4
|
+
* @param {IFormatOutputFormat} outputFormat - IFormatOutputFormat
|
|
5
|
+
* @returns A boolean
|
|
6
|
+
*/
|
|
7
|
+
export declare const isDateTimeFormat: (outputFormat: IFormatOutputFormat) => boolean;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isDateTimeFormat = void 0;
|
|
4
|
+
const DATETIME_COLUMN_FORMAT_1 = require("../../dates/constants/DATETIME_COLUMN_FORMAT");
|
|
5
|
+
/**
|
|
6
|
+
* It checks if the outputFormat is a date time format.
|
|
7
|
+
* @param {IFormatOutputFormat} outputFormat - IFormatOutputFormat
|
|
8
|
+
* @returns A boolean
|
|
9
|
+
*/
|
|
10
|
+
const isDateTimeFormat = (outputFormat) => {
|
|
11
|
+
var _a, _b;
|
|
12
|
+
const format = (outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.format) === "Default" && ((_a = outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.originalFormat) === null || _a === void 0 ? void 0 : _a.format)
|
|
13
|
+
? (_b = outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.originalFormat) === null || _b === void 0 ? void 0 : _b.format
|
|
14
|
+
: outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.format;
|
|
15
|
+
return DATETIME_COLUMN_FORMAT_1.DATETIME_COLUMN_FORMAT.some((opt) => format === null || format === void 0 ? void 0 : format.includes(opt));
|
|
16
|
+
};
|
|
17
|
+
exports.isDateTimeFormat = isDateTimeFormat;
|
package/dist/cjs/format/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.formatWithLocale = exports.chooseLang = exports.getLang = void 0;
|
|
4
|
-
const DATETIME_COLUMN_FORMAT_1 = require("../dates/constants/DATETIME_COLUMN_FORMAT");
|
|
5
4
|
const isEmpty_1 = require("../general/mix/isEmpty");
|
|
6
5
|
const definition_1 = require("./definition");
|
|
7
6
|
const durationFormatter_1 = require("./duration/durationFormatter");
|
|
7
|
+
const isDateTimeFormat_1 = require("./helpers/isDateTimeFormat");
|
|
8
8
|
const getLang = (locale) => {
|
|
9
9
|
if (!locale)
|
|
10
10
|
return;
|
|
@@ -36,8 +36,7 @@ function formatLocaleDate(value, outputFormat, config) {
|
|
|
36
36
|
const dateParam = new Date(dateValue);
|
|
37
37
|
let langOpts = options;
|
|
38
38
|
if (outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.originalFormat) {
|
|
39
|
-
|
|
40
|
-
if (DATETIME_COLUMN_FORMAT_1.DATETIME_COLUMN_FORMAT.includes(format))
|
|
39
|
+
if ((0, isDateTimeFormat_1.isDateTimeFormat)(outputFormat))
|
|
41
40
|
langOpts = definition_1.DATETIME_OPTIONS;
|
|
42
41
|
}
|
|
43
42
|
try {
|
|
@@ -1,9 +1 @@
|
|
|
1
|
-
export const DATETIME_COLUMN_FORMAT = [
|
|
2
|
-
"MM/DD/YYYY HH24:MM:SS",
|
|
3
|
-
"DD/MM/YYYY HH24:MM:SS",
|
|
4
|
-
"YYYY-MM-DD HH24:MM:SS",
|
|
5
|
-
"MM/DD/YYYY HH24:MI:SS",
|
|
6
|
-
"DD/MM/YYYY HH24:MI:SS",
|
|
7
|
-
"YYYY-MM-DD HH24:MI:SS",
|
|
8
|
-
"YYYY-MM-DD HH:mm:ss",
|
|
9
|
-
];
|
|
1
|
+
export const DATETIME_COLUMN_FORMAT = ["HH24:MM:SS", "HH24:MI:SS", "HH:mm:ss"];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./isDateTimeFormat";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./isDateTimeFormat";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IFormatOutputFormat } from "../../interfaces/format/IFormatOutputFormat.Interface";
|
|
2
|
+
/**
|
|
3
|
+
* It checks if the outputFormat is a date time format.
|
|
4
|
+
* @param {IFormatOutputFormat} outputFormat - IFormatOutputFormat
|
|
5
|
+
* @returns A boolean
|
|
6
|
+
*/
|
|
7
|
+
export declare const isDateTimeFormat: (outputFormat: IFormatOutputFormat) => boolean;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DATETIME_COLUMN_FORMAT } from "../../dates/constants/DATETIME_COLUMN_FORMAT";
|
|
2
|
+
/**
|
|
3
|
+
* It checks if the outputFormat is a date time format.
|
|
4
|
+
* @param {IFormatOutputFormat} outputFormat - IFormatOutputFormat
|
|
5
|
+
* @returns A boolean
|
|
6
|
+
*/
|
|
7
|
+
export const isDateTimeFormat = (outputFormat) => {
|
|
8
|
+
var _a, _b;
|
|
9
|
+
const format = (outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.format) === "Default" && ((_a = outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.originalFormat) === null || _a === void 0 ? void 0 : _a.format)
|
|
10
|
+
? (_b = outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.originalFormat) === null || _b === void 0 ? void 0 : _b.format
|
|
11
|
+
: outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.format;
|
|
12
|
+
return DATETIME_COLUMN_FORMAT.some((opt) => format === null || format === void 0 ? void 0 : format.includes(opt));
|
|
13
|
+
};
|
package/dist/format/index.d.ts
CHANGED
package/dist/format/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { DATETIME_COLUMN_FORMAT } from "../dates/constants/DATETIME_COLUMN_FORMAT";
|
|
2
1
|
import { isEmpty } from "../general/mix/isEmpty";
|
|
3
2
|
import { currencyISO, LANG_DEFAULT, CURRENCY_DEFAULT, DATETIME_OPTIONS, } from "./definition";
|
|
4
3
|
import { DurationFormatter } from "./duration/durationFormatter";
|
|
4
|
+
import { isDateTimeFormat } from "./helpers/isDateTimeFormat";
|
|
5
5
|
export const getLang = (locale) => {
|
|
6
6
|
if (!locale)
|
|
7
7
|
return;
|
|
@@ -30,8 +30,7 @@ function formatLocaleDate(value, outputFormat, config) {
|
|
|
30
30
|
const dateParam = new Date(dateValue);
|
|
31
31
|
let langOpts = options;
|
|
32
32
|
if (outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.originalFormat) {
|
|
33
|
-
|
|
34
|
-
if (DATETIME_COLUMN_FORMAT.includes(format))
|
|
33
|
+
if (isDateTimeFormat(outputFormat))
|
|
35
34
|
langOpts = DATETIME_OPTIONS;
|
|
36
35
|
}
|
|
37
36
|
try {
|