Skip to content

Commit

Permalink
Fixed bug #1 - empty links not handled
Browse files Browse the repository at this point in the history
  • Loading branch information
gaurang847 committed Mar 18, 2022
1 parent 694491f commit 895888d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/couponMail.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ function _formTable(coupons, headers){

function _formRow(coupon){
const row = "";
coupon[COUPON_COLUMNS.LINK] = "".concat("<a href='", coupon[COUPON_COLUMNS.LINK], "'>Click</a>");

const formattedLink = `<a href='${coupon[COUPON_COLUMNS.LINK]}'>Click</a>`;
coupon[COUPON_COLUMNS.LINK] = coupon[COUPON_COLUMNS.LINK] ? "" : formattedLink;

let expiryDate = new Date(coupon[COUPON_COLUMNS.EXPIRY]).toDateString();
if (expiryDate === "Invalid Date") expiryDate = "Not available";
Expand Down

0 comments on commit 895888d

Please sign in to comment.