@flumens/utils 0.11.0 → 0.12.0

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/date.d.ts CHANGED
@@ -1,4 +1,18 @@
1
+ /**
2
+ * @deprecated
3
+ */
1
4
  export declare const dateFormat: Intl.DateTimeFormat;
5
+ /**
6
+ * UK Date format: DD/MM/YYYY
7
+ */
8
+ export declare const dateFormatGB: Intl.DateTimeFormat;
9
+ /**
10
+ * ISO date format: YYYY-MM-DD
11
+ */
12
+ export declare const dateFormatISO: Intl.DateTimeFormat;
13
+ /**
14
+ * ISO Time format: HH:mm
15
+ */
2
16
  export declare const timeFormat: Intl.DateTimeFormat;
3
17
  export declare const getRelativeDate: (date: string | number | Date) => string;
4
18
  /**
package/dist/date.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.toISOTimezoneString=exports.isValidDate=exports.getRelativeDate=exports.timeFormat=exports.dateFormat=void 0,exports.dateFormat=new Intl.DateTimeFormat("en-GB",{day:"numeric",month:"numeric",year:"numeric"}),exports.timeFormat=new Intl.DateTimeFormat("en-GB",{hour:"numeric",minute:"numeric"});exports.getRelativeDate=e=>{const t=new Date(e),r=exports.dateFormat.format(t),a=new Date;if(exports.dateFormat.format(a)===r)return"Today";const o=new Date;o.setDate(o.getDate()-1);return exports.dateFormat.format(o)===r?"Yesterday":r};exports.isValidDate=e=>{const t=new Date(e);return t instanceof Date&&!isNaN(t)};exports.toISOTimezoneString=e=>{const t=-e.getTimezoneOffset(),r=t>=0?"+":"-",a=function(e){return(e<10?"0":"")+e};return`${e.getFullYear()}-${a(e.getMonth()+1)}-${a(e.getDate())}T${a(e.getHours())}:${a(e.getMinutes())}:${a(e.getSeconds())}${r}${a(Math.floor(Math.abs(t)/60))}:${a(Math.abs(t)%60)}`};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.toISOTimezoneString=exports.isValidDate=exports.getRelativeDate=exports.timeFormat=exports.dateFormatISO=exports.dateFormatGB=exports.dateFormat=void 0,exports.dateFormat=new Intl.DateTimeFormat("en-GB",{day:"numeric",month:"numeric",year:"numeric"}),exports.dateFormatGB=exports.dateFormat,exports.dateFormatISO=new Intl.DateTimeFormat("lt-LT",{day:"numeric",month:"numeric",year:"numeric"}),exports.timeFormat=new Intl.DateTimeFormat("en-GB",{hour:"numeric",minute:"numeric"});exports.getRelativeDate=e=>{const t=new Date(e),r=exports.dateFormatGB.format(t),a=new Date;if(exports.dateFormatGB.format(a)===r)return"Today";const o=new Date;o.setDate(o.getDate()-1);return exports.dateFormatGB.format(o)===r?"Yesterday":r};exports.isValidDate=e=>{const t=new Date(e);return t instanceof Date&&!isNaN(t)};exports.toISOTimezoneString=e=>{const t=-e.getTimezoneOffset(),r=t>=0?"+":"-",a=function(e){return(e<10?"0":"")+e};return`${e.getFullYear()}-${a(e.getMonth()+1)}-${a(e.getDate())}T${a(e.getHours())}:${a(e.getMinutes())}:${a(e.getSeconds())}${r}${a(Math.floor(Math.abs(t)/60))}:${a(Math.abs(t)%60)}`};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flumens/utils",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {