current-exif-date
Version:
Get the current date as an Exif date format
25 lines (19 loc) • 512 B
JavaScript
;
const {format} = require('exif-date');
module.exports = function currentExifDate(...args) {
const argLen = args.length;
if (argLen !== 0) {
throw new RangeError(`Expected no arguments, but got ${argLen} argument${
argLen === 1 ? '' : 's'
}.`);
}
const currentDate = new Date();
return format(new Date(Date.UTC(
currentDate.getFullYear(),
currentDate.getMonth(),
currentDate.getDate(),
currentDate.getHours(),
currentDate.getMinutes(),
currentDate.getSeconds()
)));
};