@firedesktop/react-base 1.22.7 → 1.23.0
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/utils/DateUtils.d.ts +3 -0
- package/dist/utils/DateUtils.js +17 -0
- package/dist/utils/DateUtils.js.map +1 -0
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/index.js +2 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +16 -16
- package/src/lib/utils/DateUtils.ts +26 -0
- package/src/lib/utils/index.ts +2 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export default function DateUtils() {
|
|
2
|
+
var dateToString = function (inComingDate, locale) {
|
|
3
|
+
if (locale === void 0) { locale = 'IT'; }
|
|
4
|
+
try {
|
|
5
|
+
if (inComingDate instanceof Date)
|
|
6
|
+
return new Intl.DateTimeFormat(locale).format(inComingDate);
|
|
7
|
+
else
|
|
8
|
+
return new Intl.DateTimeFormat(locale).format(new Date(inComingDate));
|
|
9
|
+
}
|
|
10
|
+
catch (err) { }
|
|
11
|
+
return '';
|
|
12
|
+
};
|
|
13
|
+
return {
|
|
14
|
+
dateToString: dateToString
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=DateUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DateUtils.js","sourceRoot":"","sources":["../../src/lib/utils/DateUtils.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,SAAS;IAW7B,IAAM,YAAY,GAAG,UAAC,YAA2B,EAAE,MAAqB;QAArB,uBAAA,EAAA,aAAqB;QACpE,IAAI;YACA,IAAI,YAAY,YAAY,IAAI;gBAC5B,OAAO,IAAI,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;;gBAE5D,OAAO,IAAI,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;SAC7E;QAAC,OAAO,GAAG,EAAE,GAAG;QAEjB,OAAO,EAAE,CAAC;IACd,CAAC,CAAC;IAEF,OAAO;QACH,YAAY,cAAA;KACf,CAAC;AACN,CAAC"}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as Fetch from './fetch';
|
|
2
2
|
import * as Configuration from './configuration';
|
|
3
|
+
import * as DateUtils from './DateUtils';
|
|
3
4
|
import FileUtils from './FileUtil';
|
|
4
5
|
import * as Labels from './labels';
|
|
5
|
-
export { Configuration, Fetch, FileUtils, Labels };
|
|
6
|
+
export { Configuration, DateUtils, Fetch, FileUtils, Labels };
|
package/dist/utils/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as Fetch from './fetch';
|
|
2
2
|
import * as Configuration from './configuration';
|
|
3
|
+
import * as DateUtils from './DateUtils';
|
|
3
4
|
import FileUtils from './FileUtil';
|
|
4
5
|
import * as Labels from './labels';
|
|
5
|
-
export { Configuration, Fetch, FileUtils, Labels };
|
|
6
|
+
export { Configuration, DateUtils, Fetch, FileUtils, Labels };
|
|
6
7
|
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lib/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,aAAa,MAAM,iBAAiB,CAAC;AACjD,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lib/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,aAAa,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firedesktop/react-base",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.23.0",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"description": "This is the FireDesktop base package used to support every React Project in this Company.",
|
|
7
7
|
"author": "alessandro.gambaro",
|
|
8
8
|
"repository": "https://firedesktopDevOps@dev.azure.com/firedesktopDevOps/baseFEComponents/_git/baseFEComponents",
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@syncfusion/ej2-popups": "19.
|
|
11
|
-
"@syncfusion/ej2-react-notifications": "19.
|
|
10
|
+
"@syncfusion/ej2-popups": "19.2.59",
|
|
11
|
+
"@syncfusion/ej2-react-notifications": "19.2.55"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
|
-
"@babel/cli": "7.14.
|
|
15
|
-
"@babel/core": "7.
|
|
14
|
+
"@babel/cli": "7.14.8",
|
|
15
|
+
"@babel/core": "7.15.0",
|
|
16
16
|
"@babel/plugin-proposal-class-properties": "7.14.5",
|
|
17
17
|
"@babel/plugin-transform-arrow-functions": "7.14.5",
|
|
18
|
-
"@babel/preset-typescript": "7.
|
|
18
|
+
"@babel/preset-typescript": "7.15.0",
|
|
19
19
|
"@testing-library/jest-dom": "5.14.1",
|
|
20
|
-
"@testing-library/react": "
|
|
21
|
-
"@testing-library/user-event": "13.1
|
|
22
|
-
"@types/jest": "
|
|
23
|
-
"@types/node": "
|
|
24
|
-
"@types/react": "17.0.
|
|
25
|
-
"@types/react-dom": "17.0.
|
|
26
|
-
"@types/react-redux": "7.1.
|
|
20
|
+
"@testing-library/react": "12.0.0",
|
|
21
|
+
"@testing-library/user-event": "13.2.1",
|
|
22
|
+
"@types/jest": "27.0.1",
|
|
23
|
+
"@types/node": "16.7.8",
|
|
24
|
+
"@types/react": "17.0.19",
|
|
25
|
+
"@types/react-dom": "17.0.9",
|
|
26
|
+
"@types/react-redux": "7.1.18",
|
|
27
27
|
"babel-plugin-minify-builtins": "0.5.0",
|
|
28
28
|
"babel-preset-minify": "0.5.1",
|
|
29
29
|
"bootstrap": "4.6.0",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"react-dom": "17.0.2",
|
|
33
33
|
"react-redux": "7.2.4",
|
|
34
34
|
"react-scripts": "4.0.3",
|
|
35
|
-
"typescript": "4.3.
|
|
36
|
-
"web-vitals": "2.0
|
|
35
|
+
"typescript": "4.3.5",
|
|
36
|
+
"web-vitals": "2.1.0"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"bootstrap": ">=4.5.3",
|
|
@@ -64,4 +64,4 @@
|
|
|
64
64
|
"last 1 safari version"
|
|
65
65
|
]
|
|
66
66
|
}
|
|
67
|
-
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export default function DateUtils() {
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Intl
|
|
5
|
+
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat
|
|
6
|
+
* format
|
|
7
|
+
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/format
|
|
8
|
+
* @param inComingDate
|
|
9
|
+
* @param locale 'en-US' or 'en' or 'US'...
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
const dateToString = (inComingDate: string | Date, locale: string = 'IT'): String => {
|
|
13
|
+
try {
|
|
14
|
+
if (inComingDate instanceof Date)
|
|
15
|
+
return new Intl.DateTimeFormat(locale).format(inComingDate);
|
|
16
|
+
else
|
|
17
|
+
return new Intl.DateTimeFormat(locale).format(new Date(inComingDate));
|
|
18
|
+
} catch (err) { }
|
|
19
|
+
|
|
20
|
+
return '';
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
dateToString
|
|
25
|
+
};
|
|
26
|
+
}
|
package/src/lib/utils/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as Fetch from './fetch';
|
|
2
2
|
import * as Configuration from './configuration';
|
|
3
|
+
import * as DateUtils from './DateUtils';
|
|
3
4
|
import FileUtils from './FileUtil';
|
|
4
5
|
import * as Labels from './labels';
|
|
5
6
|
|
|
6
|
-
export { Configuration, Fetch, FileUtils, Labels };
|
|
7
|
+
export { Configuration, DateUtils, Fetch, FileUtils, Labels };
|