Created
December 27, 2022 14:55
-
-
Save mikaelvesavuori/f35b7cbcf8e66628bfc5aca21680250d to your computer and use it in GitHub Desktop.
Create and return 10-digit Unix-formatted expiration time for a DynamoDB item.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * @description Create and return 10-digit Unix-formatted expiration time for a DynamoDB item. | |
| */ | |
| export function getExpiryTime(expirationInMinutes = 10): string { | |
| const date = new Date(); | |
| return date | |
| .setMinutes(date.getMinutes() + expirationInMinutes) | |
| .toString() | |
| .substring(0, 10); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment