mirror of
https://github.com/marcogll/passkit-generator.git
synced 2026-03-16 01:25:30 +00:00
Added setExpirationDate implementation along with tests
This commit is contained in:
17
src/processDate.ts
Normal file
17
src/processDate.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { dateToW3CString } from "./utils";
|
||||
import formatMessage, { ERROR, DEBUG } from "./messages";
|
||||
|
||||
export function processDate(key: string, date: Date): string | null {
|
||||
if (!(date instanceof Date)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const dateParse = dateToW3CString(date);
|
||||
|
||||
if (!dateParse) {
|
||||
console.warn(formatMessage(DEBUG.DATE_FORMAT_UNMATCH, key));
|
||||
return null;
|
||||
}
|
||||
|
||||
return dateParse;
|
||||
}
|
||||
Reference in New Issue
Block a user