Skip to content

Commit

Permalink
fix: Snapshot timestamp used day of the week
Browse files Browse the repository at this point in the history
This also caused issues while deleting old snapshots as the sort didn't work as expected.
  • Loading branch information
kichik committed Jul 20, 2022
1 parent 5ed873a commit e798fa9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/parameters.lambda.ts
Expand Up @@ -120,7 +120,7 @@ exports.handler = async function (input: Input): Promise<Parameters> {
}

const timestamp = new Date();
const snapshotSuffix = `-${timestamp.getUTCFullYear()}${timestamp.getUTCMonth().toString().padStart(2, '0')}${timestamp.getUTCDay().toString().padStart(2, '0')}${timestamp.getUTCHours().toString().padStart(2, '0')}${timestamp.getUTCMinutes().toString().padStart(2, '0')}`;
const snapshotSuffix = `-${timestamp.getUTCFullYear()}${(timestamp.getUTCMonth() + 1).toString().padStart(2, '0')}${timestamp.getUTCDate().toString().padStart(2, '0')}${timestamp.getUTCHours().toString().padStart(2, '0')}${timestamp.getUTCMinutes().toString().padStart(2, '0')}`;
const targetSnapshotId = `${input.snapshotPrefix}${snapshotSuffix}`;

const tempSuffix = crypto.randomBytes(8).toString('hex');
Expand Down Expand Up @@ -153,4 +153,4 @@ exports.handler = async function (input: Input): Promise<Parameters> {
confirmLength('targetSnapshotId', result.targetSnapshotId);

return result;
};
};

0 comments on commit e798fa9

Please sign in to comment.