@starley/ion-directives 1.2.16 → 1.2.18

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/index.d.ts CHANGED
@@ -4,3 +4,4 @@ export * from './tap/tap.directive';
4
4
  export * from './directive.module';
5
5
  export { IonUtilsProvider } from './provider/ion-utils-provider';
6
6
  export { ConnectorSqlitePwaProvider } from './provider/connector-sqlite-pwa.provider';
7
+ export { DateUtilProvider } from './provider/date-util-provider';
package/dist/index.js CHANGED
@@ -4,4 +4,5 @@ export * from './tap/tap.directive';
4
4
  export * from './directive.module';
5
5
  export { IonUtilsProvider } from './provider/ion-utils-provider';
6
6
  export { ConnectorSqlitePwaProvider } from './provider/connector-sqlite-pwa.provider';
7
+ export { DateUtilProvider } from './provider/date-util-provider';
7
8
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC;AAClD,cAAc,mCAAmC,CAAC;AAClD,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAC","sourcesContent":["export * from './input-mask/input-mask.directive';\nexport * from './press-hold/press-hold.directive';\nexport * from './tap/tap.directive';\nexport * from './directive.module';\nexport { IonUtilsProvider } from './provider/ion-utils-provider';\nexport { ConnectorSqlitePwaProvider } from './provider/connector-sqlite-pwa.provider';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC;AAClD,cAAc,mCAAmC,CAAC;AAClD,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC","sourcesContent":["export * from './input-mask/input-mask.directive';\nexport * from './press-hold/press-hold.directive';\nexport * from './tap/tap.directive';\nexport * from './directive.module';\nexport { IonUtilsProvider } from './provider/ion-utils-provider';\nexport { ConnectorSqlitePwaProvider } from './provider/connector-sqlite-pwa.provider';\nexport { DateUtilProvider } from './provider/date-util-provider';"]}
@@ -0,0 +1,44 @@
1
+ import * as i0 from "@angular/core";
2
+ /**
3
+ * Date utils
4
+ * @author Starley Cazorla
5
+ */
6
+ export declare class DateUtilProvider {
7
+ /**
8
+ * Veifica se a data e valida
9
+ * @param date
10
+ * @returns
11
+ */
12
+ isValidDate(date: string): boolean;
13
+ /**
14
+ * Converts date to int
15
+ * @author Starley Cazorla
16
+ * @param data
17
+ * @returns date to int
18
+ */
19
+ convertDateToInt(data: string): number;
20
+ /**
21
+ * Determines whether today is
22
+ * @author Starley Cazorla
23
+ * @param dateInput
24
+ * @returns true if today
25
+ */
26
+ isToday(dateInput: any): boolean;
27
+ /**
28
+ * Determines whether date is bigger today is
29
+ * @author Starley Cazorla
30
+ * @param dateInput
31
+ * @returns true if date is bigger today
32
+ */
33
+ isDateIsSmallerToday(dateInput: any): boolean;
34
+ /**
35
+ * Firsts bigger than second
36
+ * @author Starley Cazorla
37
+ * @param firstDate
38
+ * @param lastDate
39
+ * @returns true if bigger than second
40
+ */
41
+ firstBiggerThanSecond(firstDate: any, lastDate: any): boolean;
42
+ static ɵfac: i0.ɵɵFactoryDeclaration<DateUtilProvider, never>;
43
+ static ɵprov: i0.ɵɵInjectableDeclaration<DateUtilProvider>;
44
+ }
@@ -0,0 +1,95 @@
1
+ import { Injectable } from "@angular/core";
2
+ import * as i0 from "@angular/core";
3
+ /**
4
+ * Date utils
5
+ * @author Starley Cazorla
6
+ */
7
+ var DateUtilProvider = /** @class */ (function () {
8
+ function DateUtilProvider() {
9
+ }
10
+ /**
11
+ * Veifica se a data e valida
12
+ * @param date
13
+ * @returns
14
+ */
15
+ DateUtilProvider.prototype.isValidDate = function (date) {
16
+ if (!date)
17
+ return false;
18
+ // Regex format: DD/MM/YYYY | DD-MM-YYYY | DD.MM.YYYY
19
+ var re = /^(?:(?:31(\/|-|\.)(?:0?[13578]|1[02]))\1|(?:(?:29|30)(\/|-|\.)(?:0?[1,3-9]|1[0-2])\2))(?:(?:1[6-9]|[2-9]\d)?\d{2})$|^(?:29(\/|-|\.)0?2\3(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))$|^(?:0?[1-9]|1\d|2[0-8])(\/|-|\.)(?:(?:0?[1-9])|(?:1[0-2]))\4(?:(?:1[6-9]|[2-9]\d)?\d{2})$/;
20
+ return re.test(date);
21
+ };
22
+ /**
23
+ * Converts date to int
24
+ * @author Starley Cazorla
25
+ * @param data
26
+ * @returns date to int
27
+ */
28
+ DateUtilProvider.prototype.convertDateToInt = function (data) {
29
+ var temp;
30
+ if (data === null || data === undefined || data.length <= 0) {
31
+ return 0;
32
+ }
33
+ data = data.substring(0, 10);
34
+ if (data.includes('/')) {
35
+ temp = data.split('/');
36
+ }
37
+ else if (data.includes('-')) {
38
+ temp = data.split('-');
39
+ }
40
+ if (temp === undefined) {
41
+ return 0;
42
+ }
43
+ else if (temp[0].length > 2) {
44
+ return temp[0] + temp[1] + temp[2];
45
+ }
46
+ else {
47
+ return temp[2] + temp[1] + temp[0];
48
+ }
49
+ };
50
+ /**
51
+ * Determines whether today is
52
+ * @author Starley Cazorla
53
+ * @param dateInput
54
+ * @returns true if today
55
+ */
56
+ DateUtilProvider.prototype.isToday = function (dateInput) {
57
+ if (dateInput && this.convertDateToInt(dateInput) === this.convertDateToInt(new Date().toLocaleDateString('pt-Br')))
58
+ return true;
59
+ return false;
60
+ };
61
+ /**
62
+ * Determines whether date is bigger today is
63
+ * @author Starley Cazorla
64
+ * @param dateInput
65
+ * @returns true if date is bigger today
66
+ */
67
+ DateUtilProvider.prototype.isDateIsSmallerToday = function (dateInput) {
68
+ if (dateInput === null || dateInput === undefined)
69
+ return false;
70
+ if (this.convertDateToInt(dateInput) < this.convertDateToInt(new Date().toLocaleDateString('pt-Br')))
71
+ return true;
72
+ return false;
73
+ };
74
+ /**
75
+ * Firsts bigger than second
76
+ * @author Starley Cazorla
77
+ * @param firstDate
78
+ * @param lastDate
79
+ * @returns true if bigger than second
80
+ */
81
+ DateUtilProvider.prototype.firstBiggerThanSecond = function (firstDate, lastDate) {
82
+ if (this.convertDateToInt(firstDate) < this.convertDateToInt(lastDate))
83
+ return true;
84
+ return false;
85
+ };
86
+ DateUtilProvider.ɵfac = function DateUtilProvider_Factory(t) { return new (t || DateUtilProvider)(); };
87
+ DateUtilProvider.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: DateUtilProvider, factory: DateUtilProvider.ɵfac, providedIn: 'root' });
88
+ return DateUtilProvider;
89
+ }());
90
+ export { DateUtilProvider };
91
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(DateUtilProvider, [{
92
+ type: Injectable,
93
+ args: [{ providedIn: 'root' }]
94
+ }], null, null); })();
95
+ //# sourceMappingURL=date-util-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date-util-provider.js","sourceRoot":"","sources":["../../src/provider/date-util-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;;AAE3C;;;GAGG;AAEH;IAAA;KA8EC;IA3EG;;;;MAIE;IACF,sCAAW,GAAX,UAAY,IAAY;QACpB,IAAI,CAAC,IAAI;YAAE,OAAO,KAAK,CAAC;QACxB,qDAAqD;QACrD,IAAM,EAAE,GAAG,sUAAsU,CAAC;QAClV,OAAO,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;IAED;;;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SAAS;YAAE,OAAO,KAAK,CAAC;QAChE,IAAI,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,IAAI,EAAE,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;YAAE,OAAO,IAAI,CAAC;QAClH,OAAO,KAAK,CAAC;IACjB,CAAC;IAED;;;;;;OAMG;IACH,gDAAqB,GAArB,UAAsB,SAAc,EAAE,QAAa;QAC/C,IAAI,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC;YAAE,OAAO,IAAI,CAAC;QACpF,OAAO,KAAK,CAAC;IACjB,CAAC;oFA5EQ,gBAAgB;0EAAhB,gBAAgB,WAAhB,gBAAgB,mBADH,MAAM;2BAPhC;CAqFC,AA9ED,IA8EC;SA7EY,gBAAgB;uFAAhB,gBAAgB;cAD5B,UAAU;eAAC,EAAE,UAAU,EAAE,MAAM,EAAE","sourcesContent":["import { Injectable } from \"@angular/core\";\n\n/**\n * Date utils\n * @author Starley Cazorla\n */\n\n@Injectable({ providedIn: 'root' })\nexport class DateUtilProvider {\n\n /**\n * Veifica se a data e valida\n * @param date \n * @returns \n */\n isValidDate(date: string) {\n if (!date) return false;\n // Regex format: DD/MM/YYYY | DD-MM-YYYY | DD.MM.YYYY\n const re = /^(?:(?:31(\\/|-|\\.)(?:0?[13578]|1[02]))\\1|(?:(?:29|30)(\\/|-|\\.)(?:0?[1,3-9]|1[0-2])\\2))(?:(?:1[6-9]|[2-9]\\d)?\\d{2})$|^(?:29(\\/|-|\\.)0?2\\3(?:(?:(?:1[6-9]|[2-9]\\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))$|^(?:0?[1-9]|1\\d|2[0-8])(\\/|-|\\.)(?:(?:0?[1-9])|(?:1[0-2]))\\4(?:(?:1[6-9]|[2-9]\\d)?\\d{2})$/;\n return re.test(date);\n }\n\n /**\n * Converts date to int\n * @author Starley Cazorla\n * @param data \n * @returns date to int \n */\n convertDateToInt(data: string): number {\n let temp: any;\n\n if (data === null || data === undefined || data.length <= 0) {\n return 0;\n }\n data = data.substring(0, 10);\n\n if (data.includes('/')) {\n temp = data.split('/');\n } else if (data.includes('-')) {\n temp = data.split('-');\n }\n\n if (temp === undefined) {\n return 0;\n } else if (temp[0].length > 2) {\n return temp[0] + temp[1] + temp[2];\n } else {\n return temp[2] + temp[1] + temp[0];\n }\n }\n\n /**\n * Determines whether today is\n * @author Starley Cazorla\n * @param dateInput \n * @returns true if today \n */\n isToday(dateInput: any): boolean {\n if (dateInput && this.convertDateToInt(dateInput) === this.convertDateToInt(new Date().toLocaleDateString('pt-Br'))) return true;\n return false;\n }\n\n /**\n * Determines whether date is bigger today is\n * @author Starley Cazorla\n * @param dateInput \n * @returns true if date is bigger today \n */\n isDateIsSmallerToday(dateInput: any): boolean {\n if (dateInput === null || dateInput === undefined) return false;\n if (this.convertDateToInt(dateInput) < this.convertDateToInt(new Date().toLocaleDateString('pt-Br'))) return true;\n return false;\n }\n\n /**\n * Firsts bigger than second\n * @author Starley Cazorla\n * @param firstDate \n * @param lastDate \n * @returns true if bigger than second \n */\n firstBiggerThanSecond(firstDate: any, lastDate: any): boolean {\n if (this.convertDateToInt(firstDate) < this.convertDateToInt(lastDate)) return true;\n return false;\n }\n}"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@starley/ion-directives",
3
- "version": "1.2.16",
3
+ "version": "1.2.18",
4
4
  "description": "Directivas internas para ionic",
5
5
  "main": "./dist/index.js",
6
6
  "typings": "./dist/index.d.ts",
@@ -13,9 +13,9 @@
13
13
  "publishPackage": "npm run build && npm publish"
14
14
  },
15
15
  "peerDependencies": {
16
- "@angular/common": "^15.2.0 || ^11.2.4 || ~10.0.0",
17
- "@angular/core": "^15.2.0 || ^11.2.4 || ~10.0.0",
18
- "@angular/forms": "^15.2.0 || ^11.2.4 || ~10.0.0"
16
+ "@angular/common": "^15.2.8 || ^11.2.4 || ~10.0.0",
17
+ "@angular/core": "^15.2.8 || ^11.2.4 || ~10.0.0",
18
+ "@angular/forms": "^15.2.8 || ^11.2.4 || ~10.0.0"
19
19
  },
20
20
  "repository": {
21
21
  "type": "git",
@@ -37,13 +37,13 @@
37
37
  },
38
38
  "homepage": "https://github.com/StarleyDev/ion-directives#readme",
39
39
  "devDependencies": {
40
- "@angular/common": "^15.2.0",
41
- "@angular/compiler": "^15.2.0",
42
- "@angular/compiler-cli": "^15.2.0",
43
- "@angular/core": "^15.2.0",
44
- "@angular/forms": "^15.2.0",
45
- "@types/node": "^18.14.1",
46
- "nodemon": "^2.0.20",
40
+ "@angular/common": "^15.2.8",
41
+ "@angular/compiler": "^15.2.8",
42
+ "@angular/compiler-cli": "^15.2.8",
43
+ "@angular/core": "^15.2.8",
44
+ "@angular/forms": "^15.2.8",
45
+ "@types/node": "^18.16.0",
46
+ "nodemon": "^2.0.22",
47
47
  "ts-node": "^10.9.1",
48
48
  "typescript": "^4.9.5"
49
49
  },