@wikicasa-dev/utilities 1.0.24 → 1.0.25
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/DateUtils.cjs +1 -1
- package/dist/DateUtils.js +1927 -477
- package/dist/index.cjs +1 -1
- package/dist/index.js +77 -76
- package/dist/utils/DateUtils.d.ts +20 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./ArrayUtils.cjs"),O=require("./ColorUtils.cjs"),a=require("./CookieUtils.cjs"),P=require("./CurrencyUtils.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./ArrayUtils.cjs"),O=require("./ColorUtils.cjs"),a=require("./CookieUtils.cjs"),P=require("./CurrencyUtils.cjs"),l=require("./DateUtils.cjs"),s=require("./DeviceDetectionUtils.cjs"),n=require("./DOMUtils.cjs"),u=require("./EmailUtils.cjs"),E=require("./FunctionUtils.cjs"),m=require("./GenericUtils.cjs"),t=require("./NumberUtils.cjs"),r=require("./ObjectUtils.cjs"),C=require("./ObserverUtils.cjs"),d=require("./PermissionUtils.cjs"),c=require("./RESB_UrlBuilder.cjs"),o=require("./StringUtils.cjs"),y=require("./URLBuilderUtils.cjs"),e=require("./RegexUtils.cjs"),g=require("./GeolocationUtils.cjs"),b=require("./AdressUtils.cjs"),S=require("./GAutocompleteUtils.cjs"),A=require("./DownloadUtils.cjs"),i=require("./MapUtils.cjs");exports.isArrNullOrEmpty=p.isArrNullOrEmpty;exports.rgba=O.rgba;exports.decodeCookie=a.decodeCookie;exports.encodeCookie=a.encodeCookie;exports.getCookie=a.getCookie;exports.removeCookie=a.removeCookie;exports.formatCurrency=P.formatCurrency;exports.formatDate=l.formatDate;exports.formatDateToddMMYYYY=l.formatDateToddMMYYYY;exports.normalizeDate=l.normalizeDate;exports.subtractDaysFromDate=l.subtractDaysFromDate;exports.getCurrentDeviceSize=s.getCurrentDeviceSize;exports.isMobile=s.isMobile;exports.isSafari=s.isSafari;exports.isWindows=s.isWindows;exports.isiOSDevice=s.isiOSDevice;exports.emptyElem=n.emptyElem;exports.getSingleElement=n.getSingleElement;exports.hideElem=n.hideElem;exports.showElem=n.showElem;exports.hash256=u.hash256;exports.hashEmail=u.hashEmail;exports.debounce=E.debounce;exports.isPromise=E.isPromise;exports.awaitableSetTimeout=m.awaitableSetTimeout;exports.createCustomEvent=m.createCustomEvent;exports.formatFloat=t.formatFloat;exports.formatInteger=t.formatInteger;exports.formatLocaleNumber=t.formatLocaleNumber;exports.formatLocaleNumberAuto=t.formatLocaleNumberAuto;exports.formatNumber=t.formatNumber;exports.formatterNumberObj=t.formatterNumberObj;exports.parseLocaleNumber=t.parseLocaleNumber;exports.parseLocaleNumberAuto=t.parseLocaleNumberAuto;exports.deepCopy=r.deepCopy;exports.getOrNull=r.getOrNull;exports.invertFlatObject=r.invertFlatObject;exports.invertKeyToValue=r.invertKeyToValue;exports.isEmptyObject=r.isEmptyObject;exports.shallowCopyObjectTo=r.shallowCopyObjectTo;exports.observeOnce=C.observeOnce;exports.addPermissionStateListener=d.addPermissionStateListener;exports.onNotificationsPermissionChange=d.onNotificationsPermissionChange;exports.buildParams=c.buildParams;exports.buildParamsForAgency=c.buildParamsForAgency;exports.buildURL=c.buildURL;exports.capitalizeFirstLetter=o.capitalizeFirstLetter;exports.cleanASCII=o.cleanASCII;exports.decodeTextWithEntities=o.decodeTextWithEntities;exports.replaceAll=o.replaceAll;exports.replaceAllTokens=o.replaceAllTokens;exports.stringToHyphened=o.stringToHyphened;exports.appendQueryString=y.appendQueryString;exports.COMPETITOR_REGEX=e.COMPETITOR_REGEX;exports.DATE_REGEX=e.DATE_REGEX;exports.EMAIL_REGEX=e.EMAIL_REGEX;exports.EMAIL_REGEX_INTO_TEXT=e.EMAIL_REGEX_INTO_TEXT;exports.EXCLUDED_REGEX=e.EXCLUDED_REGEX;exports.GLOBAL_PHONE_REGEX=e.GLOBAL_PHONE_REGEX;exports.PASSWORD_REGEX=e.PASSWORD_REGEX;exports.PHONE_REGEX=e.PHONE_REGEX;exports.ROOMS_REGEX=e.ROOMS_REGEX;exports.SQM_REGEX=e.SQM_REGEX;exports.browserSupportGeolocation=g.browserSupportGeolocation;exports.getUserPosition=g.getUserPosition;exports.formatAddress=b.formatAddress;exports.formattedAddress=b.formattedAddress;exports.googlePlaceConverter=S.googlePlaceConverter;exports.downloadFile=A.downloadFile;exports.calcPolygonCenter=i.calcPolygonCenter;exports.encodePolygon=i.encodePolygon;exports.getMinMaxLatLng=i.getMinMaxLatLng;exports.getPolygonString=i.getPolygonString;exports.parsePoints=i.parsePoints;exports.removeDuplicatePoints=i.removeDuplicatePoints;
|
package/dist/index.js
CHANGED
|
@@ -1,99 +1,100 @@
|
|
|
1
1
|
import { isArrNullOrEmpty as r } from "./ArrayUtils.js";
|
|
2
2
|
import { rgba as a } from "./ColorUtils.js";
|
|
3
|
-
import { decodeCookie as i, encodeCookie as l, getCookie as
|
|
3
|
+
import { decodeCookie as i, encodeCookie as l, getCookie as n, removeCookie as p } from "./CookieUtils.js";
|
|
4
4
|
import { formatCurrency as E } from "./CurrencyUtils.js";
|
|
5
|
-
import { formatDate as c, formatDateToddMMYYYY as d,
|
|
6
|
-
import { getCurrentDeviceSize as
|
|
7
|
-
import { emptyElem as
|
|
8
|
-
import { hash256 as
|
|
9
|
-
import { debounce as X, isPromise as
|
|
10
|
-
import { awaitableSetTimeout as
|
|
11
|
-
import { formatFloat as
|
|
12
|
-
import { deepCopy as
|
|
13
|
-
import { observeOnce as
|
|
14
|
-
import { addPermissionStateListener as
|
|
15
|
-
import { buildParams as
|
|
16
|
-
import { capitalizeFirstLetter as pe, cleanASCII as se, decodeTextWithEntities as
|
|
17
|
-
import { appendQueryString as
|
|
18
|
-
import { COMPETITOR_REGEX as
|
|
19
|
-
import { browserSupportGeolocation as
|
|
20
|
-
import { formatAddress as Xe, formattedAddress as
|
|
21
|
-
import { googlePlaceConverter as
|
|
22
|
-
import { downloadFile as
|
|
23
|
-
import { calcPolygonCenter as
|
|
5
|
+
import { formatDate as c, formatDateToddMMYYYY as d, normalizeDate as x, subtractDaysFromDate as u } from "./DateUtils.js";
|
|
6
|
+
import { getCurrentDeviceSize as b, isMobile as O, isSafari as P, isWindows as C, isiOSDevice as y } from "./DeviceDetectionUtils.js";
|
|
7
|
+
import { emptyElem as L, getSingleElement as R, hideElem as S, showElem as T } from "./DOMUtils.js";
|
|
8
|
+
import { hash256 as D, hashEmail as G } from "./EmailUtils.js";
|
|
9
|
+
import { debounce as X, isPromise as h } from "./FunctionUtils.js";
|
|
10
|
+
import { awaitableSetTimeout as v, createCustomEvent as I } from "./GenericUtils.js";
|
|
11
|
+
import { formatFloat as F, formatInteger as k, formatLocaleNumber as j, formatLocaleNumberAuto as Y, formatNumber as z, formatterNumberObj as H, parseLocaleNumber as U, parseLocaleNumberAuto as W } from "./NumberUtils.js";
|
|
12
|
+
import { deepCopy as B, getOrNull as K, invertFlatObject as V, invertKeyToValue as q, isEmptyObject as J, shallowCopyObjectTo as Z } from "./ObjectUtils.js";
|
|
13
|
+
import { observeOnce as ee } from "./ObserverUtils.js";
|
|
14
|
+
import { addPermissionStateListener as re, onNotificationsPermissionChange as te } from "./PermissionUtils.js";
|
|
15
|
+
import { buildParams as me, buildParamsForAgency as ie, buildURL as le } from "./RESB_UrlBuilder.js";
|
|
16
|
+
import { capitalizeFirstLetter as pe, cleanASCII as se, decodeTextWithEntities as Ee, replaceAll as fe, replaceAllTokens as ce, stringToHyphened as de } from "./StringUtils.js";
|
|
17
|
+
import { appendQueryString as ue } from "./URLBuilderUtils.js";
|
|
18
|
+
import { COMPETITOR_REGEX as be, DATE_REGEX as Oe, EMAIL_REGEX as Pe, EMAIL_REGEX_INTO_TEXT as Ce, EXCLUDED_REGEX as ye, GLOBAL_PHONE_REGEX as Ae, PASSWORD_REGEX as Le, PHONE_REGEX as Re, ROOMS_REGEX as Se, SQM_REGEX as Te } from "./RegexUtils.js";
|
|
19
|
+
import { browserSupportGeolocation as De, getUserPosition as Ge } from "./GeolocationUtils.js";
|
|
20
|
+
import { formatAddress as Xe, formattedAddress as he } from "./AdressUtils.js";
|
|
21
|
+
import { googlePlaceConverter as ve } from "./GAutocompleteUtils.js";
|
|
22
|
+
import { downloadFile as we } from "./DownloadUtils.js";
|
|
23
|
+
import { calcPolygonCenter as ke, encodePolygon as je, getMinMaxLatLng as Ye, getPolygonString as ze, parsePoints as He, removeDuplicatePoints as Ue } from "./MapUtils.js";
|
|
24
24
|
export {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
25
|
+
be as COMPETITOR_REGEX,
|
|
26
|
+
Oe as DATE_REGEX,
|
|
27
|
+
Pe as EMAIL_REGEX,
|
|
28
|
+
Ce as EMAIL_REGEX_INTO_TEXT,
|
|
29
|
+
ye as EXCLUDED_REGEX,
|
|
30
|
+
Ae as GLOBAL_PHONE_REGEX,
|
|
31
|
+
Le as PASSWORD_REGEX,
|
|
32
|
+
Re as PHONE_REGEX,
|
|
33
|
+
Se as ROOMS_REGEX,
|
|
34
|
+
Te as SQM_REGEX,
|
|
35
|
+
re as addPermissionStateListener,
|
|
36
|
+
ue as appendQueryString,
|
|
37
|
+
v as awaitableSetTimeout,
|
|
38
|
+
De as browserSupportGeolocation,
|
|
39
|
+
me as buildParams,
|
|
40
|
+
ie as buildParamsForAgency,
|
|
41
|
+
le as buildURL,
|
|
42
|
+
ke as calcPolygonCenter,
|
|
43
43
|
pe as capitalizeFirstLetter,
|
|
44
44
|
se as cleanASCII,
|
|
45
|
-
|
|
45
|
+
I as createCustomEvent,
|
|
46
46
|
X as debounce,
|
|
47
47
|
i as decodeCookie,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
Ee as decodeTextWithEntities,
|
|
49
|
+
B as deepCopy,
|
|
50
|
+
we as downloadFile,
|
|
51
|
+
L as emptyElem,
|
|
52
52
|
l as encodeCookie,
|
|
53
|
-
|
|
53
|
+
je as encodePolygon,
|
|
54
54
|
Xe as formatAddress,
|
|
55
55
|
E as formatCurrency,
|
|
56
56
|
c as formatDate,
|
|
57
57
|
d as formatDateToddMMYYYY,
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
58
|
+
F as formatFloat,
|
|
59
|
+
k as formatInteger,
|
|
60
|
+
j as formatLocaleNumber,
|
|
61
|
+
Y as formatLocaleNumberAuto,
|
|
62
|
+
z as formatNumber,
|
|
63
|
+
he as formattedAddress,
|
|
64
64
|
H as formatterNumberObj,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
65
|
+
n as getCookie,
|
|
66
|
+
b as getCurrentDeviceSize,
|
|
67
|
+
Ye as getMinMaxLatLng,
|
|
68
|
+
K as getOrNull,
|
|
69
|
+
ze as getPolygonString,
|
|
70
|
+
R as getSingleElement,
|
|
71
71
|
Ge as getUserPosition,
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
ve as googlePlaceConverter,
|
|
73
|
+
D as hash256,
|
|
74
74
|
G as hashEmail,
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
S as hideElem,
|
|
76
|
+
V as invertFlatObject,
|
|
77
|
+
q as invertKeyToValue,
|
|
78
78
|
r as isArrNullOrEmpty,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
79
|
+
J as isEmptyObject,
|
|
80
|
+
O as isMobile,
|
|
81
|
+
h as isPromise,
|
|
82
|
+
P as isSafari,
|
|
83
|
+
C as isWindows,
|
|
84
|
+
y as isiOSDevice,
|
|
85
|
+
x as normalizeDate,
|
|
86
|
+
ee as observeOnce,
|
|
87
|
+
te as onNotificationsPermissionChange,
|
|
87
88
|
U as parseLocaleNumber,
|
|
88
89
|
W as parseLocaleNumberAuto,
|
|
89
90
|
He as parsePoints,
|
|
90
|
-
|
|
91
|
+
p as removeCookie,
|
|
91
92
|
Ue as removeDuplicatePoints,
|
|
92
|
-
|
|
93
|
-
|
|
93
|
+
fe as replaceAll,
|
|
94
|
+
ce as replaceAllTokens,
|
|
94
95
|
a as rgba,
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
Z as shallowCopyObjectTo,
|
|
97
|
+
T as showElem,
|
|
98
|
+
de as stringToHyphened,
|
|
99
|
+
u as subtractDaysFromDate
|
|
99
100
|
};
|
|
@@ -14,3 +14,23 @@ export declare const formatDateToddMMYYYY: (date: Date | string) => string;
|
|
|
14
14
|
* @returns {Date} A new Date object representing the result of subtracting the specified days from the initial date.
|
|
15
15
|
*/
|
|
16
16
|
export declare const subtractDaysFromDate: (initialDate: Date | undefined, days: number) => Date;
|
|
17
|
+
/**
|
|
18
|
+
* Normalizes a date string into a standardized format.
|
|
19
|
+
* Accepts different input formats and attempts to convert them to 'yyyy-MM-dd' format.
|
|
20
|
+
*
|
|
21
|
+
* @param {string} keyword - The string containing the date to normalize.
|
|
22
|
+
* Accepted formats:
|
|
23
|
+
* - yyyy-MM-dd
|
|
24
|
+
* - yyyy/MM/dd
|
|
25
|
+
* - dd/MM/yyyy
|
|
26
|
+
* - dd-MM-yyyy
|
|
27
|
+
*
|
|
28
|
+
* @returns {string|null} The normalized date in 'yyyy-MM-dd' format if valid,
|
|
29
|
+
* null if the date cannot be parsed in any of the supported formats.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* normalizeDate('2024-03-25') // returns '2024-03-25'
|
|
33
|
+
* normalizeDate('25/03/2024') // returns '2024-03-25'
|
|
34
|
+
* normalizeDate('invalid') // returns null
|
|
35
|
+
*/
|
|
36
|
+
export declare function normalizeDate(keyword: string): string | null;
|