@qrvey/utils 1.10.0-8 → 1.10.0-9
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.
|
@@ -20,6 +20,8 @@ function dateToMdyDate(date, settings) {
|
|
|
20
20
|
const dt = new Date(timezonedDate.valueOf());
|
|
21
21
|
if (!(0, isValidDateObject_1.isValidDateObject)(dt))
|
|
22
22
|
return date;
|
|
23
|
-
return `${(0, padLeadingZeros_1.padLeadingZeros)(dt.getUTCMonth() + 1, 2).slice(-2)}/${(0, padLeadingZeros_1.padLeadingZeros)(dt.getUTCDate(), 2).slice(-2)}/${(0, padLeadingZeros_1.padLeadingZeros)(dt.getUTCFullYear(), 4)}${
|
|
23
|
+
return `${(0, padLeadingZeros_1.padLeadingZeros)(dt.getUTCMonth() + 1, 2).slice(-2)}/${(0, padLeadingZeros_1.padLeadingZeros)(dt.getUTCDate(), 2).slice(-2)}/${(0, padLeadingZeros_1.padLeadingZeros)(dt.getUTCFullYear(), 4)}${defaultSettings.convertMiliseconds
|
|
24
|
+
? ` ${(0, dateToHms_1.dateToHms)(date, defaultSettings)}`
|
|
25
|
+
: ""}`;
|
|
24
26
|
}
|
|
25
27
|
exports.dateToMdyDate = dateToMdyDate;
|
|
@@ -7,9 +7,13 @@ exports.defineFormat = exports.validateColumnType = exports.parseFormulaType = e
|
|
|
7
7
|
const d3_format_1 = require("d3-format");
|
|
8
8
|
const dayjs_1 = __importDefault(require("dayjs"));
|
|
9
9
|
const definition_1 = require("./definition");
|
|
10
|
+
//* *dayjs plugins */
|
|
10
11
|
const isoWeek_1 = __importDefault(require("dayjs/plugin/isoWeek"));
|
|
11
12
|
const advancedFormat_1 = __importDefault(require("dayjs/plugin/advancedFormat"));
|
|
12
13
|
const utc_1 = __importDefault(require("dayjs/plugin/utc"));
|
|
14
|
+
const weekYear_1 = __importDefault(require("dayjs/plugin/weekYear"));
|
|
15
|
+
const weekOfYear_1 = __importDefault(require("dayjs/plugin/weekOfYear"));
|
|
16
|
+
//* * end dayjs plugin imports */
|
|
13
17
|
const isEmpty_1 = require("../general/mix/isEmpty");
|
|
14
18
|
const get_1 = require("../general/object/get");
|
|
15
19
|
const COLUMN_1 = require("../columns/constants/COLUMN");
|
|
@@ -21,6 +25,8 @@ const cloneDeep_1 = require("../general/object/cloneDeep");
|
|
|
21
25
|
dayjs_1.default.extend(isoWeek_1.default); // Add support for iso week format https://github.com/iamkun/dayjs/issues/1328
|
|
22
26
|
dayjs_1.default.extend(advancedFormat_1.default); // Add support to advanced formats https://day.js.org/docs/en/plugin/advanced-format
|
|
23
27
|
dayjs_1.default.extend(utc_1.default);
|
|
28
|
+
dayjs_1.default.extend(weekYear_1.default);
|
|
29
|
+
dayjs_1.default.extend(weekOfYear_1.default);
|
|
24
30
|
/**
|
|
25
31
|
* Apply to the given date format to a date value
|
|
26
32
|
* @param bytes type number
|
|
@@ -17,5 +17,7 @@ export function dateToMdyDate(date, settings) {
|
|
|
17
17
|
const dt = new Date(timezonedDate.valueOf());
|
|
18
18
|
if (!isValidDateObject(dt))
|
|
19
19
|
return date;
|
|
20
|
-
return `${padLeadingZeros(dt.getUTCMonth() + 1, 2).slice(-2)}/${padLeadingZeros(dt.getUTCDate(), 2).slice(-2)}/${padLeadingZeros(dt.getUTCFullYear(), 4)}${
|
|
20
|
+
return `${padLeadingZeros(dt.getUTCMonth() + 1, 2).slice(-2)}/${padLeadingZeros(dt.getUTCDate(), 2).slice(-2)}/${padLeadingZeros(dt.getUTCFullYear(), 4)}${defaultSettings.convertMiliseconds
|
|
21
|
+
? ` ${dateToHms(date, defaultSettings)}`
|
|
22
|
+
: ""}`;
|
|
21
23
|
}
|
package/dist/format/format.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { format as d3Format } from "d3-format";
|
|
2
2
|
import dayjs from "dayjs";
|
|
3
3
|
import { DATEGROUP_FORMATTING_UNSUPPORT, appliesFormatting, hasfileSizeProperty, isTextColumn, DEFAULT_DATE, } from "./definition";
|
|
4
|
+
//* *dayjs plugins */
|
|
4
5
|
import isoWeek from "dayjs/plugin/isoWeek";
|
|
5
6
|
import advancedFormat from "dayjs/plugin/advancedFormat";
|
|
6
7
|
import utc from "dayjs/plugin/utc";
|
|
8
|
+
import weekYear from "dayjs/plugin/weekYear";
|
|
9
|
+
import weekOfYear from "dayjs/plugin/weekOfYear";
|
|
10
|
+
//* * end dayjs plugin imports */
|
|
7
11
|
import { isEmpty } from "../general/mix/isEmpty";
|
|
8
12
|
import { _get } from "../general/object/get";
|
|
9
13
|
import { COLUMN } from "../columns/constants/COLUMN";
|
|
@@ -15,6 +19,8 @@ import { cloneDeep } from "../general/object/cloneDeep";
|
|
|
15
19
|
dayjs.extend(isoWeek); // Add support for iso week format https://github.com/iamkun/dayjs/issues/1328
|
|
16
20
|
dayjs.extend(advancedFormat); // Add support to advanced formats https://day.js.org/docs/en/plugin/advanced-format
|
|
17
21
|
dayjs.extend(utc);
|
|
22
|
+
dayjs.extend(weekYear);
|
|
23
|
+
dayjs.extend(weekOfYear);
|
|
18
24
|
/**
|
|
19
25
|
* Apply to the given date format to a date value
|
|
20
26
|
* @param bytes type number
|