diff --git a/site/gatsby-site/src/components/checklists/ExportDropdown.js b/site/gatsby-site/src/components/checklists/ExportDropdown.js index 509051178d..97e0808a71 100644 --- a/site/gatsby-site/src/components/checklists/ExportDropdown.js +++ b/site/gatsby-site/src/components/checklists/ExportDropdown.js @@ -8,7 +8,7 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; const ExportDropdown = ({ checklist }) => { const label = ( <> - + Export ); diff --git a/site/gatsby-site/src/templates/backups.js b/site/gatsby-site/src/templates/backups.js index 95754aaa76..1839193505 100644 --- a/site/gatsby-site/src/templates/backups.js +++ b/site/gatsby-site/src/templates/backups.js @@ -15,6 +15,31 @@ const Backups = ({ pageContext, ...props }) => { return null; } + /** + * Parses the creation date from the backup key. + * + * The expected format of the key is "backup-YYYYMMDDHHmmss.tar.bz2" (e.g. "backup-20240101101425.tar.bz2"). + * The function extracts the date and time from the key and returns a JavaScript Date object. + * + * @param {string} key - The backup key. + * @returns {Date} The creation date of the backup. + */ + const parseCreationDate = (key) => { + const stringDate = key.split('backup-')[1].split('.')[0]; + + const year = stringDate.substring(0, 4); + + const month = stringDate.substring(4, 6); + + const day = stringDate.substring(6, 8); + + const hour = stringDate.substring(8, 10); + + const minute = stringDate.substring(10, 12); + + return new Date(year, month - 1, day, hour, minute); + }; + return ( <> @@ -65,10 +90,11 @@ const Backups = ({ pageContext, ...props }) => { .map((b) => ({ ...b, Url: `${config.cloudflareR2.publicBucketUrl}/${b.Key}`, + CreationDate: parseCreationDate(b.Key), })) .map((value) => (
  • - {format(new Date(value['LastModified']), 'yyyy-MM-dd hh:mm a')} ·{' '} + {format(new Date(value['CreationDate']), 'yyyy-MM-dd hh:mm a')} ·{' '} {(value['Size'] / 1000000).toFixed(2)} MB ·{' '} {value['Key']}