Added support to relevantDate renaming to date

This commit is contained in:
Alexander Cerutti
2025-09-18 14:11:57 +02:00
parent 756f301e4a
commit 95983ffc84
2 changed files with 36 additions and 7 deletions

View File

@@ -45,9 +45,19 @@ export interface RelevancyInterval {
endDate: string | Date;
}
export interface RelevancyEntry {
relevantDate: string | Date;
}
/**
* @iOSVersion 18 => "relevantDate"
* @iOSVersion 26 => "date"
*/
export type RelevancyEntry =
| {
date: string | Date;
relevantDate?: string | Date;
}
| {
date?: string | Date;
relevantDate: string | Date;
};
/**
* @iOSVersion 18
@@ -73,6 +83,14 @@ export const RelevantDate = Joi.alternatives(
).required(),
}),
Joi.object<RelevancyEntry>().keys({
/**
* Since iOS 26
*/
date: Joi.alternatives(Joi.string().isoDate(), Joi.date().iso()),
/**
* Since iOS 18, then was renamed in
* 'date' in iOS 26 (what a breaking change)
*/
relevantDate: Joi.alternatives(
Joi.string().isoDate(),
Joi.date().iso(),