mirror of
https://github.com/kunkunsh/kunkun-ext-image-processing.git
synced 2025-04-03 18:06:42 +00:00
21 lines
537 B
TypeScript
21 lines
537 B
TypeScript
import { ExifDateTime } from 'exiftool-vendored';
|
|
import type { ImageMetadata } from '@hk/photographer-toolbox/types';
|
|
import { ImageMetadataMod } from '../src/types.ts';
|
|
|
|
export function convertDate(data: ImageMetadata): ImageMetadataMod {
|
|
const dateKeys = [
|
|
'DateTimeOriginal',
|
|
'FileModifyDate',
|
|
'ModifyDate',
|
|
'CreateDate',
|
|
'dateCreated',
|
|
'dateModified'
|
|
];
|
|
for (const key of dateKeys) {
|
|
if (data[key] && typeof data[key] !== 'string') {
|
|
data[key] = (data[key] as ExifDateTime).toISOString();
|
|
}
|
|
}
|
|
return data;
|
|
}
|