@firedesktop/react-base 1.23.0 → 1.23.2

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.
@@ -1,3 +1,5 @@
1
1
  export default function DateUtils(): {
2
2
  dateToString: (inComingDate: string | Date, locale?: string) => String;
3
+ dateToString_Italian: (inComingDate: string | Date, separator: string) => string;
4
+ isoStringToDate: (value: string | undefined) => Date | undefined;
3
5
  };
@@ -3,15 +3,47 @@ export default function DateUtils() {
3
3
  if (locale === void 0) { locale = 'IT'; }
4
4
  try {
5
5
  if (inComingDate instanceof Date)
6
- return new Intl.DateTimeFormat(locale).format(inComingDate);
6
+ return new Intl.DateTimeFormat(locale, {}).format(inComingDate);
7
7
  else
8
8
  return new Intl.DateTimeFormat(locale).format(new Date(inComingDate));
9
9
  }
10
10
  catch (err) { }
11
11
  return '';
12
12
  };
13
+ var dateToString_Italian = function (inComingDate, separator) {
14
+ try {
15
+ var day = 0;
16
+ var month = 0;
17
+ var year = 0;
18
+ if (inComingDate instanceof Date) {
19
+ day = inComingDate.getDate();
20
+ month = inComingDate.getMonth();
21
+ year = inComingDate.getFullYear();
22
+ }
23
+ else {
24
+ var newD = new Date(inComingDate);
25
+ day = newD.getDate();
26
+ month = newD.getMonth();
27
+ year = newD.getFullYear();
28
+ }
29
+ return "" + ('' + day).padStart(2, '0') + separator + ('' + (month + 1)).padStart(2, '0') + separator + year;
30
+ }
31
+ catch (err) { }
32
+ return '';
33
+ };
34
+ var isoStringToDate = function (value) {
35
+ if (!value)
36
+ return undefined;
37
+ try {
38
+ return new Date(value);
39
+ }
40
+ catch (err) { }
41
+ return undefined;
42
+ };
13
43
  return {
14
- dateToString: dateToString
44
+ dateToString: dateToString,
45
+ dateToString_Italian: dateToString_Italian,
46
+ isoStringToDate: isoStringToDate
15
47
  };
16
48
  }
17
49
  //# sourceMappingURL=DateUtils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DateUtils.js","sourceRoot":"","sources":["../../src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,CAAC;YAEb,IAAI,YAAY,YAAY,IAAI,EAAE;gBAC9B,GAAG,GAAG,YAAY,CAAC,OAAO,EAAE,CAAC;gBAC7B,KAAK,GAAG,YAAY,CAAC,QAAQ,EAAE,CAAC;gBAChC,IAAI,GAAG,YAAY,CAAC,WAAW,EAAE,CAAC;aACrC;iBACI;gBACD,IAAM,IAAI,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC;gBACpC,GAAG,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;gBACrB,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACxB,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;aAC7B;YAED,OAAO,KAAG,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,SAAS,GAAG,CAAC,EAAE,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,SAAS,GAAG,IAAM,CAAC;SAChH;QAAC,OAAO,GAAG,EAAE,GAAG;QAEjB,OAAO,EAAE,CAAC;IACd,CAAC,CAAC;IAEF,IAAM,eAAe,GAAG,UAAC,KAAyB;QAC9C,IAAI,CAAC,KAAK;YACN,OAAO,SAAS,CAAC;QAErB,IAAI;YACA,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC;SAC1B;QAAC,OAAO,GAAG,EAAE,GAAG;QAEjB,OAAO,SAAS,CAAC;IACrB,CAAC,CAAC;IAEF,OAAO;QACH,YAAY,cAAA;QACZ,oBAAoB,sBAAA;QACpB,eAAe,iBAAA;KAClB,CAAC;AACN,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import * as Fetch from './fetch';
2
2
  import * as Configuration from './configuration';
3
- import * as DateUtils from './DateUtils';
3
+ import DateUtils from './DateUtils';
4
4
  import FileUtils from './FileUtil';
5
5
  import * as Labels from './labels';
6
6
  export { Configuration, DateUtils, Fetch, FileUtils, Labels };
@@ -1,6 +1,6 @@
1
1
  import * as Fetch from './fetch';
2
2
  import * as Configuration from './configuration';
3
- import * as DateUtils from './DateUtils';
3
+ import DateUtils from './DateUtils';
4
4
  import FileUtils from './FileUtil';
5
5
  import * as Labels from './labels';
6
6
  export { Configuration, DateUtils, Fetch, FileUtils, Labels };
@@ -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,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"}
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,aAAa,CAAC;AACpC,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,27 +1,27 @@
1
1
  {
2
2
  "name": "@firedesktop/react-base",
3
- "version": "1.23.0",
3
+ "version": "1.23.2",
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.2.59",
11
- "@syncfusion/ej2-react-notifications": "19.2.55"
10
+ "@syncfusion/ej2-popups": "19.2.62",
11
+ "@syncfusion/ej2-react-notifications": "19.2.60"
12
12
  },
13
13
  "devDependencies": {
14
- "@babel/cli": "7.14.8",
15
- "@babel/core": "7.15.0",
14
+ "@babel/cli": "7.15.7",
15
+ "@babel/core": "7.15.5",
16
16
  "@babel/plugin-proposal-class-properties": "7.14.5",
17
17
  "@babel/plugin-transform-arrow-functions": "7.14.5",
18
18
  "@babel/preset-typescript": "7.15.0",
19
19
  "@testing-library/jest-dom": "5.14.1",
20
- "@testing-library/react": "12.0.0",
20
+ "@testing-library/react": "12.1.0",
21
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",
22
+ "@types/jest": "27.0.2",
23
+ "@types/node": "16.9.4",
24
+ "@types/react": "17.0.22",
25
25
  "@types/react-dom": "17.0.9",
26
26
  "@types/react-redux": "7.1.18",
27
27
  "babel-plugin-minify-builtins": "0.5.0",
@@ -30,9 +30,9 @@
30
30
  "copyfiles": "2.4.1",
31
31
  "react": "17.0.2",
32
32
  "react-dom": "17.0.2",
33
- "react-redux": "7.2.4",
33
+ "react-redux": "7.2.5",
34
34
  "react-scripts": "4.0.3",
35
- "typescript": "4.3.5",
35
+ "typescript": "4.4.3",
36
36
  "web-vitals": "2.1.0"
37
37
  },
38
38
  "peerDependencies": {
@@ -64,4 +64,4 @@
64
64
  "last 1 safari version"
65
65
  ]
66
66
  }
67
- }
67
+ }
package/src/App.tsx CHANGED
@@ -4,6 +4,8 @@ import { createStore } from 'redux';
4
4
 
5
5
  import { Components, ConfigurationLoader, Utils, LanguageLoader } from './lib';
6
6
 
7
+ import DateUtils from './lib/utils/DateUtils';
8
+
7
9
  import TestLabelFunction from './TestLabelFunction';
8
10
 
9
11
  import 'bootstrap/dist/css/bootstrap.css';
@@ -141,6 +143,12 @@ function App() {
141
143
  }) : ''}
142
144
 
143
145
  <br />
146
+ <br />
147
+ <br />
148
+ <br />
149
+ {DateUtils().dateToString_Italian(new Date(), '-')}
150
+
151
+
144
152
  <Components.AppInput appIcon={<Components.AppIcon name={'user'} className={'tertiary-svg'} iconClassName='login_form_svg' />}
145
153
  type='text'
146
154
  placeholder='username---'
@@ -12,7 +12,9 @@ export default function DateUtils() {
12
12
  const dateToString = (inComingDate: string | Date, locale: string = 'IT'): String => {
13
13
  try {
14
14
  if (inComingDate instanceof Date)
15
- return new Intl.DateTimeFormat(locale).format(inComingDate);
15
+ return new Intl.DateTimeFormat(locale, {
16
+
17
+ }).format(inComingDate);
16
18
  else
17
19
  return new Intl.DateTimeFormat(locale).format(new Date(inComingDate));
18
20
  } catch (err) { }
@@ -20,7 +22,44 @@ export default function DateUtils() {
20
22
  return '';
21
23
  };
22
24
 
25
+ const dateToString_Italian = (inComingDate: string | Date, separator: string): string => {
26
+ try {
27
+ let day = 0;
28
+ let month = 0;
29
+ let year = 0;
30
+
31
+ if (inComingDate instanceof Date) {
32
+ day = inComingDate.getDate();
33
+ month = inComingDate.getMonth();
34
+ year = inComingDate.getFullYear();
35
+ }
36
+ else {
37
+ const newD = new Date(inComingDate);
38
+ day = newD.getDate();
39
+ month = newD.getMonth();
40
+ year = newD.getFullYear();
41
+ }
42
+
43
+ return `${('' + day).padStart(2, '0')}${separator}${('' + (month + 1)).padStart(2, '0')}${separator}${year}`;
44
+ } catch (err) { }
45
+
46
+ return '';
47
+ };
48
+
49
+ const isoStringToDate = (value: string | undefined): Date | undefined => {
50
+ if (!value)
51
+ return undefined;
52
+
53
+ try {
54
+ return new Date(value);
55
+ } catch (err) { }
56
+
57
+ return undefined;
58
+ };
59
+
23
60
  return {
24
- dateToString
61
+ dateToString,
62
+ dateToString_Italian,
63
+ isoStringToDate
25
64
  };
26
65
  }
@@ -1,6 +1,6 @@
1
1
  import * as Fetch from './fetch';
2
2
  import * as Configuration from './configuration';
3
- import * as DateUtils from './DateUtils';
3
+ import DateUtils from './DateUtils';
4
4
  import FileUtils from './FileUtil';
5
5
  import * as Labels from './labels';
6
6