mirror of
https://github.com/marcogll/passkit-generator.git
synced 2026-03-16 06:26:09 +00:00
Improved check on dates; added genericDebug to show debug messages
This commit is contained in:
17
index.js
17
index.js
@@ -7,6 +7,7 @@ const archiver = require("archiver");
|
|||||||
const moment = require("moment");
|
const moment = require("moment");
|
||||||
const schema = require("./schema");
|
const schema = require("./schema");
|
||||||
const barcodeDebug = require("debug")("passkit:barcode");
|
const barcodeDebug = require("debug")("passkit:barcode");
|
||||||
|
const genericDebug = require("debug")("passkit:generic");
|
||||||
const { areas: fieldsName, FieldsContainer } = require("./fields");
|
const { areas: fieldsName, FieldsContainer } = require("./fields");
|
||||||
const { errors, warnings } = require("./messages");
|
const { errors, warnings } = require("./messages");
|
||||||
|
|
||||||
@@ -200,7 +201,13 @@ class Pass {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.props.expirationDate = dateToW3CString(date);
|
let dataParse = dateToW3CString(date);
|
||||||
|
|
||||||
|
if (!dateParse) {
|
||||||
|
genericDebug("Expiration Date was not set due to invalid format.");
|
||||||
|
} else {
|
||||||
|
this.props.expirationDate = dataParse;
|
||||||
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@@ -255,7 +262,13 @@ class Pass {
|
|||||||
length: 1
|
length: 1
|
||||||
}, this);
|
}, this);
|
||||||
} else if (type === "relevantDate") {
|
} else if (type === "relevantDate") {
|
||||||
this.props[type] = dateToW3CString(data);
|
let dateParse = dateToW3CString(data);
|
||||||
|
|
||||||
|
if (!dateParse) {
|
||||||
|
genericDebug("Relevant Date was not set due to incorrect date format.");
|
||||||
|
} else {
|
||||||
|
this.props[type] = dataParse;
|
||||||
|
}
|
||||||
|
|
||||||
return Object.assign({
|
return Object.assign({
|
||||||
length: Number(!!convDate)
|
length: Number(!!convDate)
|
||||||
|
|||||||
Reference in New Issue
Block a user