@integraciones_doc24/sdk 0.42.0 → 0.42.1
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/lib/utils.d.ts +1 -1
- package/lib/utils.js +4 -3
- package/package.json +1 -1
package/lib/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Doc24 } from '.';
|
|
2
2
|
export declare const parseDate: (str: string) => Date;
|
|
3
|
-
export declare const parseDateTime: (str: string, timeZone
|
|
3
|
+
export declare const parseDateTime: (str: string, timeZone?: string | null | undefined) => Date;
|
|
4
4
|
export declare const parseDateTimeTzAR: (str: string) => Date;
|
|
5
5
|
export declare const getIndetificationTypeId: (type: Doc24.IdentificationType) => number;
|
package/lib/utils.js
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getIndetificationTypeId = exports.parseDateTimeTzAR = exports.parseDateTime = exports.parseDate = void 0;
|
|
4
4
|
const date_fns_1 = require("date-fns");
|
|
5
|
-
//
|
|
6
|
-
const
|
|
5
|
+
// Offset por defecto cuando Doc24 no envia time_zone en la respuesta
|
|
6
|
+
const DEFAULT_TIME_ZONE = '-03';
|
|
7
|
+
const parseDate = (str) => exports.parseDateTime(`${str} 00:00:00`, DEFAULT_TIME_ZONE);
|
|
7
8
|
exports.parseDate = parseDate;
|
|
8
|
-
const parseDateTime = (str, timeZone) => date_fns_1.parse(`${str} ${timeZone}`, 'yyyy-MM-dd HH:mm:ss X', new Date());
|
|
9
|
+
const parseDateTime = (str, timeZone) => date_fns_1.parse(`${str} ${timeZone || DEFAULT_TIME_ZONE}`, 'yyyy-MM-dd HH:mm:ss X', new Date());
|
|
9
10
|
exports.parseDateTime = parseDateTime;
|
|
10
11
|
const parseDateTimeTzAR = (str) => date_fns_1.parse(`${str} -03`, 'yyyy-MM-dd HH:mm:ss X', new Date());
|
|
11
12
|
exports.parseDateTimeTzAR = parseDateTimeTzAR;
|