diff --git a/src/_data/buildInfo.js b/src/_data/buildInfo.js new file mode 100644 index 0000000..33c3788 --- /dev/null +++ b/src/_data/buildInfo.js @@ -0,0 +1,21 @@ +const packageJson = require('../../package.json'); + +module.exports = () => { + const now = new Date(); + const { timeZone } = Intl.DateTimeFormat().resolvedOptions(); + const buildDate = Intl.DateTimeFormat('fr-CA', { + year: 'numeric', + month: '2-digit', + day: '2-digit', + }).format(now); + const buildTime = Intl.DateTimeFormat('nl-NL', { hour: '2-digit', minute: '2-digit' }).format( + now, + ); + return { + version: packageJson.version, + time: { + raw: now.toISOString(), + formatted: `${buildDate} ${buildTime} ${timeZone}`, + }, + }; +};