@shopify/cli-kit
Version:
A set of utilities, interfaces, and models that are common across all the platform features
32 lines • 1.12 kB
JavaScript
const deprecationsStore = {
nextDeprecationDate: undefined,
};
/**
* Get the earliest date in the future when deprecations will no longer be supported, if any.
*
* @returns The next deprecation date.
*/
export function getNextDeprecationDate() {
return deprecationsStore.nextDeprecationDate;
}
/**
* Set the next deprecation date to the earliest date in the future.
*
* @param dates - Dates when deprecations will no longer be supported.
*/
export function setNextDeprecationDate(dates) {
if (dates.length < 1)
return;
const earliestFutureDateTime = earliestDateTimeAfter(Date.now(), dates);
if (!earliestFutureDateTime)
return;
const nextDeprecationDate = getNextDeprecationDate();
if (!nextDeprecationDate || earliestFutureDateTime < nextDeprecationDate.getTime()) {
deprecationsStore.nextDeprecationDate = new Date(earliestFutureDateTime);
}
}
function earliestDateTimeAfter(afterTime, dates) {
const times = dates.map((date) => date.getTime());
return times.sort().find((time) => time > afterTime);
}
//# sourceMappingURL=deprecations-store.js.map