@stackbit/cms-contentful
Version:
Stackbit Contentful CMS Interface
12 lines (10 loc) • 403 B
text/typescript
import { BasicMetaSysProps } from 'contentful-management';
export function getLastUpdatedEntityDate(entities: { sys: BasicMetaSysProps }[]): string | undefined {
let lastUpdatedDate: string = '';
for (const entity of entities) {
if (entity.sys.updatedAt > lastUpdatedDate) {
lastUpdatedDate = entity.sys.updatedAt;
}
}
return lastUpdatedDate || undefined;
}