@open-tender/store 0.3.35 → 0.3.36

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.
@@ -4,10 +4,12 @@ export declare const TIME = " hh:mm:ss";
4
4
  export declare const DATETIME = "yyyy-MM-dd hh:mm:ss";
5
5
  export declare const HUMAN_TIME = "h:mma";
6
6
  export declare const HUMAN_DATETIME = "MMM d, h:mma";
7
+ export declare const ISO_STRING = "yyyy-MM-dd'T'HH:mm:ssXXX";
7
8
  export declare const timezoneMap: TimezoneMap;
8
9
  export declare const getUserTimezone: () => string;
9
10
  export declare const currentLocalDate: (tz: Timezone) => Date;
10
11
  export declare const currentLocalDateStr: (tz: Timezone, fmt?: string) => string;
12
+ export declare const currentLocalIso: (tz: Timezone) => string;
11
13
  export declare const dateToIso: (date: Date, tz: Timezone) => ISOString;
12
14
  export declare const isoToDate: (dt: ISOStringOffset, tz: Timezone) => Date;
13
15
  export declare const isoToDateStr: (dt: ISOStringOffset, tz: Timezone, fmt?: string) => string;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.timeLeft = exports.secondsToTime = exports.secondsLeft = exports.minutesLeft = exports.makeIntervals = exports.getNextInterval = exports.getLastInterval = exports.formatDateStr = exports.formatDate = exports.replaceAmPm = exports.cleanISOString = exports.adjustZonedIso = exports.isoToDateStr = exports.isoToDate = exports.dateToIso = exports.currentLocalDateStr = exports.currentLocalDate = exports.getUserTimezone = exports.timezoneMap = exports.HUMAN_DATETIME = exports.HUMAN_TIME = exports.DATETIME = exports.TIME = exports.DATE = void 0;
3
+ exports.timeLeft = exports.secondsToTime = exports.secondsLeft = exports.minutesLeft = exports.makeIntervals = exports.getNextInterval = exports.getLastInterval = exports.formatDateStr = exports.formatDate = exports.replaceAmPm = exports.cleanISOString = exports.adjustZonedIso = exports.isoToDateStr = exports.isoToDate = exports.dateToIso = exports.currentLocalIso = exports.currentLocalDateStr = exports.currentLocalDate = exports.getUserTimezone = exports.timezoneMap = exports.ISO_STRING = exports.HUMAN_DATETIME = exports.HUMAN_TIME = exports.DATETIME = exports.TIME = exports.DATE = void 0;
4
4
  var date_fns_1 = require("date-fns");
5
5
  var date_fns_tz_1 = require("date-fns-tz");
6
6
  exports.DATE = 'yyyy-MM-dd';
@@ -9,6 +9,7 @@ exports.DATETIME = 'yyyy-MM-dd hh:mm:ss';
9
9
  var HUMAN_DATE = 'MMM d, yyyy';
10
10
  exports.HUMAN_TIME = 'h:mma';
11
11
  exports.HUMAN_DATETIME = 'MMM d, h:mma';
12
+ exports.ISO_STRING = "yyyy-MM-dd'T'HH:mm:ssXXX";
12
13
  exports.timezoneMap = {
13
14
  'US/Eastern': 'America/New_York',
14
15
  'US/Central': 'America/Chicago',
@@ -33,6 +34,10 @@ var currentLocalDateStr = function (tz, fmt) {
33
34
  return (0, date_fns_tz_1.formatInTimeZone)(new Date(), tz, fmt);
34
35
  };
35
36
  exports.currentLocalDateStr = currentLocalDateStr;
37
+ var currentLocalIso = function (tz) {
38
+ return (0, date_fns_tz_1.formatInTimeZone)(new Date(), tz, exports.ISO_STRING);
39
+ };
40
+ exports.currentLocalIso = currentLocalIso;
36
41
  var dateToIso = function (date, tz) {
37
42
  return (0, exports.cleanISOString)((0, date_fns_tz_1.zonedTimeToUtc)(date, tz));
38
43
  };
@@ -50,7 +55,7 @@ exports.isoToDateStr = isoToDateStr;
50
55
  var adjustZonedIso = function (dt, tz, adjustment) {
51
56
  var date = (0, exports.isoToDate)(dt, tz);
52
57
  var adj = (0, date_fns_1.add)(date, adjustment);
53
- return (0, date_fns_tz_1.formatInTimeZone)(adj, tz, "yyyy-MM-dd'T'HH:mm:ssXXX");
58
+ return (0, date_fns_tz_1.formatInTimeZone)(adj, tz, exports.ISO_STRING);
54
59
  };
55
60
  exports.adjustZonedIso = adjustZonedIso;
56
61
  var cleanISOString = function (date) {
@@ -4,10 +4,12 @@ export declare const TIME = " hh:mm:ss";
4
4
  export declare const DATETIME = "yyyy-MM-dd hh:mm:ss";
5
5
  export declare const HUMAN_TIME = "h:mma";
6
6
  export declare const HUMAN_DATETIME = "MMM d, h:mma";
7
+ export declare const ISO_STRING = "yyyy-MM-dd'T'HH:mm:ssXXX";
7
8
  export declare const timezoneMap: TimezoneMap;
8
9
  export declare const getUserTimezone: () => string;
9
10
  export declare const currentLocalDate: (tz: Timezone) => Date;
10
11
  export declare const currentLocalDateStr: (tz: Timezone, fmt?: string) => string;
12
+ export declare const currentLocalIso: (tz: Timezone) => string;
11
13
  export declare const dateToIso: (date: Date, tz: Timezone) => ISOString;
12
14
  export declare const isoToDate: (dt: ISOStringOffset, tz: Timezone) => Date;
13
15
  export declare const isoToDateStr: (dt: ISOStringOffset, tz: Timezone, fmt?: string) => string;
@@ -6,6 +6,7 @@ export var DATETIME = 'yyyy-MM-dd hh:mm:ss';
6
6
  var HUMAN_DATE = 'MMM d, yyyy';
7
7
  export var HUMAN_TIME = 'h:mma';
8
8
  export var HUMAN_DATETIME = 'MMM d, h:mma';
9
+ export var ISO_STRING = "yyyy-MM-dd'T'HH:mm:ssXXX";
9
10
  export var timezoneMap = {
10
11
  'US/Eastern': 'America/New_York',
11
12
  'US/Central': 'America/Chicago',
@@ -27,6 +28,9 @@ export var currentLocalDateStr = function (tz, fmt) {
27
28
  if (fmt === void 0) { fmt = DATE; }
28
29
  return formatInTimeZone(new Date(), tz, fmt);
29
30
  };
31
+ export var currentLocalIso = function (tz) {
32
+ return formatInTimeZone(new Date(), tz, ISO_STRING);
33
+ };
30
34
  export var dateToIso = function (date, tz) {
31
35
  return cleanISOString(zonedTimeToUtc(date, tz));
32
36
  };
@@ -41,7 +45,7 @@ export var isoToDateStr = function (dt, tz, fmt) {
41
45
  export var adjustZonedIso = function (dt, tz, adjustment) {
42
46
  var date = isoToDate(dt, tz);
43
47
  var adj = add(date, adjustment);
44
- return formatInTimeZone(adj, tz, "yyyy-MM-dd'T'HH:mm:ssXXX");
48
+ return formatInTimeZone(adj, tz, ISO_STRING);
45
49
  };
46
50
  export var cleanISOString = function (date) {
47
51
  return (date.toISOString().split('.')[0] + 'Z');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-tender/store",
3
- "version": "0.3.35",
3
+ "version": "0.3.36",
4
4
  "description": "A library of hooks, reducers, utility functions, and types for use with Open Tender applications that utilize our in-store POS API",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",