@ix_waterford/lib 1.0.33 → 1.0.35

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,25 +1,10 @@
1
1
  import { type Dayjs } from 'dayjs';
2
- /**
3
- * Parses a date and returns a Dayjs object if valid
4
- * @param date - The date to parse (Date, string, number, Dayjs object, or boolean)
5
- * @param utc - Whether to parse the date in UTC (default: false)
6
- * @returns Dayjs object if valid, null otherwise
7
- */
8
- export declare const parseDate: (date: Date | string | number | Dayjs | boolean | null | undefined, utc?: boolean) => Dayjs | null;
9
2
  /**
10
3
  * Formats a date to a specific format string
11
4
  * @param date - The date to format (Date, string, number, Dayjs object, or boolean)
12
5
  * @param format - The format string (e.g., 'YYYY-MM-DD', 'MM/DD/YYYY', 'DD-MMM-YYYY')
13
- * @param utc - Whether to format the date in UTC
6
+ * @param utc - Whether to format the date in UTC (default: false)
14
7
  * @returns Formatted date string, or null if date is invalid
15
8
  */
16
9
  export declare const formatDate: (date: Date | string | number | Dayjs | boolean | null | undefined, format: string, utc?: boolean) => string | null;
17
- /**
18
- * Subtracts days from a date and returns a Dayjs object
19
- * @param date - The date to subtract days from (Date, string, number, Dayjs object, or boolean)
20
- * @param days - The number of days to subtract
21
- * @param utc - Whether to parse the date in UTC (default: false)
22
- * @returns Dayjs object if valid, null otherwise
23
- */
24
- export declare const subtractDaysFromDate: (date: Date | string | number | Dayjs | boolean | null | undefined, days: number, utc?: boolean) => Dayjs | null;
25
10
  //# sourceMappingURL=date.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../../../src/utils/date.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,KAAK,KAAK,EAAE,MAAM,OAAO,CAAC;AAK1C;;;;;GAKG;AACH,eAAO,MAAM,SAAS,GAAI,MAAM,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,EAAE,MAAK,OAAe,KAAG,KAAK,GAAG,IAa3H,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,GAAI,MAAM,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,EAAE,QAAQ,MAAM,EAAE,MAAM,OAAO,KAAG,MAAM,GAAG,IAMtI,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,GAAI,MAAM,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,EAAE,MAAM,MAAM,EAAE,MAAK,OAAe,KAAG,KAAK,GAAG,IAMpJ,CAAC"}
1
+ {"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../../../src/utils/date.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,KAAK,KAAK,EAAE,MAAM,OAAO,CAAC;AAK1C;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,GAAI,MAAM,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,EAAE,QAAQ,MAAM,EAAE,MAAK,OAAe,KAAG,MAAM,GAAG,IAa7I,CAAC"}
@@ -1,4 +1,4 @@
1
- export { formatDate, parseDate, subtractDaysFromDate } from './date';
1
+ export { formatDate } from './date';
2
2
  export { isValidEmail } from './email';
3
3
  export { isEmpty, isEmptyString, isEmptyArray, isEmptyObject, getColorFromId, strEllipsis, getFormattedName, } from './global';
4
4
  export { getLocalStorageItem, setLocalStorageItem, removeLocalStorageItem } from './localStorage';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EACH,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EACnD,cAAc,EAAE,WAAW,EAAE,gBAAgB,GAChD,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAClG,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EACH,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EACnD,cAAc,EAAE,WAAW,EAAE,gBAAgB,GAChD,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAClG,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1 @@
1
+ let t,e,r,s,a,o,i,n,c,l,u,f,_,p,h,m;import g from"dayjs";var d,S,$={826:function(t){t.exports=function(){"use strict";var t="minute",e=/[+-]\d\d(?::?\d\d)?/g,r=/([+-]|\d\d)/g;return function(s,a,o){var i=a.prototype;o.utc=function(t){var e={date:t,utc:!0,args:arguments};return new a(e)},i.utc=function(e){var r=o(this.toDate(),{locale:this.$L,utc:!0});return e?r.add(this.utcOffset(),t):r},i.local=function(){return o(this.toDate(),{locale:this.$L,utc:!1})};var n=i.parse;i.parse=function(t){t.utc&&(this.$u=!0),this.$utils().u(t.$offset)||(this.$offset=t.$offset),n.call(this,t)};var c=i.init;i.init=function(){if(this.$u){var t=this.$d;this.$y=t.getUTCFullYear(),this.$M=t.getUTCMonth(),this.$D=t.getUTCDate(),this.$W=t.getUTCDay(),this.$H=t.getUTCHours(),this.$m=t.getUTCMinutes(),this.$s=t.getUTCSeconds(),this.$ms=t.getUTCMilliseconds()}else c.call(this)};var l=i.utcOffset;i.utcOffset=function(s,a){var o=this.$utils().u;if(o(s))return this.$u?0:o(this.$offset)?l.call(this):this.$offset;if("string"==typeof s&&null===(s=function(t){void 0===t&&(t="");var s=t.match(e);if(!s)return null;var a=(""+s[0]).match(r)||["-",0,0],o=a[0],i=60*a[1]+ +a[2];return 0===i?0:"+"===o?i:-i}(s)))return this;var i=16>=Math.abs(s)?60*s:s;if(0===i)return this.utc(a);var n=this.clone();if(a)return n.$offset=i,n.$u=!1,n;var c=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(n=this.local().add(i+c,t)).$offset=i,n.$x.$localOffset=c,n};var u=i.format;i.format=function(t){var e=t||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return u.call(this,e)},i.valueOf=function(){var t=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*t},i.isUTC=function(){return!!this.$u},i.toISOString=function(){return this.toDate().toISOString()},i.toString=function(){return this.toDate().toUTCString()};var f=i.toDate;i.toDate=function(t){return"s"===t&&this.$offset?o(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():f.call(this)};var _=i.diff;i.diff=function(t,e,r){if(t&&this.$u===t.$u)return _.call(this,t,e,r);var s=this.local(),a=o(t).local();return _.call(s,a,e,r)}}}()}},y={};function v(t){var e=y[t];if(void 0!==e)return e.exports;var r=y[t]={exports:{}};return $[t].call(r.exports,r,r.exports,v),r.exports}v.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return v.d(e,{a:e}),e},v.d=(t,e)=>{for(var r in e)v.o(e,r)&&!v.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},v.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var b={};v.d(b,{Xm:()=>l,J2:()=>h,_S:()=>u,X:()=>m,u5:()=>c,VP:()=>s,sc:()=>_,Hd:()=>p,B9:()=>e,bs:()=>n,Yq:()=>t,AP:()=>f,RI:()=>a,Im:()=>o,jw:()=>r}),d=v(826),S=v.n(d),g.extend(S()),t=function(t,e){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];try{if(!t||"boolean"==typeof t)return null;let s=r?g.utc(t):g(t);if(!s.isValid())return null;return s.format(e)}catch(t){return null}},e=t=>!!t&&"string"==typeof t&&/^(?!\.)(?!.*\.\.)[A-Za-z0-9.!#$%&'*+/=?^_`{|}~-]+(?<!\.)@[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,}$/.test(t.trim()),r=t=>null==t||"string"==typeof t&&0===t.trim().length,s=t=>null==t||!!Array.isArray(t)&&0===t.length,a=t=>null==t||!Array.isArray(t)&&t.constructor===Object&&0===Object.keys(t).length,o=t=>null==t||("string"==typeof t?r(t):Array.isArray(t)?s(t):"object"==typeof t&&a(t)),i=["#e57373","#f06292","#ba68c8","#9575cd","#c5cae9","#7986cb","#4fc3f7","#4dd0e1","#4db6ac","#81c784","#aed581","#dce775","#ffee58","#ffca28","#ff7043","#8d6e63","#bdbdbd"],n=t=>t||0===t?i[String(t).split("").reduce((t,e)=>t+e.charCodeAt(0),0)%i.length]:i[0],c=t=>t?t.slice().split(" ").map(t=>t[0]||"").join("").slice(0,2).toUpperCase():"",l=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:25,r="string"==typeof t?t.trim():String(t??"");return r.length>e?`${r.substring(0,e)}...`:r},u=t=>{try{let e=window.localStorage.getItem(t);return e?JSON.parse(e):null}catch(t){return null}},f=(t,e)=>{try{return window.localStorage.setItem(t,JSON.stringify(e)),!0}catch(t){return!1}},_=t=>{try{return window.localStorage.removeItem(t),!0}catch{return!1}},p=t=>{try{let e=window.sessionStorage.getItem(t);return e?JSON.parse(e):null}catch{return null}},h=(t,e)=>{try{return window.sessionStorage.setItem(t,JSON.stringify(e)),!0}catch{return!1}},m=t=>{try{return window.sessionStorage.removeItem(t),!0}catch{return!1}};var w=b.Yq,I=b.bs,x=b.u5,O=b._S,D=b.Hd,k=b.Im,A=b.VP,C=b.RI,T=b.jw,E=b.B9,j=b.sc,U=b.X,Y=b.AP,M=b.J2,H=b.Xm;export{w as formatDate,I as getColorFromId,x as getFormattedName,O as getLocalStorageItem,D as getSessionStorageItem,k as isEmpty,A as isEmptyArray,C as isEmptyObject,T as isEmptyString,E as isValidEmail,j as removeLocalStorageItem,U as removeSessionStorageItem,Y as setLocalStorageItem,M as setSessionStorageItem,H as strEllipsis};
package/dist/utils.html CHANGED
@@ -1 +1 @@
1
- <!doctype html><html><head><title>Rsbuild App</title><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><script defer src="/utils.12af4304.js"></script></head><body><div id="root"></div></body></html>
1
+ <!doctype html><html><head><title>Rsbuild App</title><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><script defer src="/utils.0599b606.js"></script></head><body><div id="root"></div></body></html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ix_waterford/lib",
3
- "version": "1.0.33",
3
+ "version": "1.0.35",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",