@open-tender/utils 0.4.82 → 0.4.84

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.
@@ -2,3 +2,4 @@ import { Discount, DiscountEnhanced, Discounts, OrderType, ServiceType } from '@
2
2
  export declare const makeValidDeals: (deals: Discounts | null, orderType?: OrderType | null, serviceType?: ServiceType | null, revenueCenterId?: number | null) => Discounts;
3
3
  export declare const makeLimitations: (item: Discount) => string;
4
4
  export declare const makeDiscountEnhanced: (item: Discount) => DiscountEnhanced;
5
+ export declare const getIsRewardExpired: (end_at: string | null) => boolean;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.makeDiscountEnhanced = exports.makeLimitations = exports.makeValidDeals = void 0;
3
+ exports.getIsRewardExpired = exports.makeDiscountEnhanced = exports.makeLimitations = exports.makeValidDeals = void 0;
4
4
  const datetimes_1 = require("./datetimes");
5
5
  const helpers_1 = require("./helpers");
6
6
  const makeValidDeals = (deals, orderType, serviceType, revenueCenterId) => {
@@ -104,3 +104,7 @@ const makeDiscountEnhanced = (item) => {
104
104
  return Object.assign(Object.assign({}, item), { imageUrl, expiration, todayOnly, limitations });
105
105
  };
106
106
  exports.makeDiscountEnhanced = makeDiscountEnhanced;
107
+ const getIsRewardExpired = (end_at) => {
108
+ return end_at ? (0, datetimes_1.dateStrToDate)(end_at) < new Date() : false;
109
+ };
110
+ exports.getIsRewardExpired = getIsRewardExpired;
@@ -2,3 +2,4 @@ import { Discount, DiscountEnhanced, Discounts, OrderType, ServiceType } from '@
2
2
  export declare const makeValidDeals: (deals: Discounts | null, orderType?: OrderType | null, serviceType?: ServiceType | null, revenueCenterId?: number | null) => Discounts;
3
3
  export declare const makeLimitations: (item: Discount) => string;
4
4
  export declare const makeDiscountEnhanced: (item: Discount) => DiscountEnhanced;
5
+ export declare const getIsRewardExpired: (end_at: string | null) => boolean;
@@ -1,4 +1,4 @@
1
- import { formatDateStr, getMinutesfromDate, makeLocalDateStr, time24ToMinutes } from './datetimes';
1
+ import { dateStrToDate, formatDateStr, getMinutesfromDate, makeLocalDateStr, time24ToMinutes } from './datetimes';
2
2
  import { makeImageMap } from './helpers';
3
3
  export const makeValidDeals = (deals, orderType, serviceType, revenueCenterId) => {
4
4
  if (!deals || !deals.length)
@@ -98,3 +98,6 @@ export const makeDiscountEnhanced = (item) => {
98
98
  const limitations = makeLimitations(item);
99
99
  return Object.assign(Object.assign({}, item), { imageUrl, expiration, todayOnly, limitations });
100
100
  };
101
+ export const getIsRewardExpired = (end_at) => {
102
+ return end_at ? dateStrToDate(end_at) < new Date() : false;
103
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-tender/utils",
3
- "version": "0.4.82",
3
+ "version": "0.4.84",
4
4
  "description": "A library of utils for use with Open Tender applications that utilize our cloud-based Order API.",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -36,7 +36,7 @@
36
36
  "private": false,
37
37
  "devDependencies": {
38
38
  "@emotion/react": "^11.10.4",
39
- "@open-tender/types": "^0.4.113",
39
+ "@open-tender/types": "^0.4.118",
40
40
  "@reduxjs/toolkit": "^1.8.5",
41
41
  "@types/google.maps": "^3.53.5",
42
42
  "@types/jest": "^29.5.11",