-
Notifications
You must be signed in to change notification settings - Fork 610
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(cloudfront-signer): parse date using Date constructor #6929
Conversation
const resultUrl = getSignedUrl({ | ||
url, | ||
keyPairId, | ||
dateLessThan: dateString, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there are two ends to the date range options, right? this needs to test the other end too.
…d dateGreaterThan parameters
781e721
to
8c6ce7b
Compare
1f71486
to
c4f8c7e
Compare
…aterThan
} | ||
|
||
private parseDateWindow(expiration: string, start?: string): PolicyDates { | ||
private parseDateWindow(expiration: string | number | Date, start?: string | number | Date): PolicyDates { | ||
const dateLessThan = this.parseDate(expiration); | ||
if (!dateLessThan) { | ||
throw new Error("dateLessThan is invalid. Ensure the date string is compatible with the Date constructor."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: should we change this message to "....Ensure the date value is compatible with the Date constructor." instead of the "date string"
Issue
#6403
Description
This PR adds changes in the parseDate function to use date constructor instead of Date.parse() to support timestamps in milliseconds.
Testing
Locally by testing it with milliseconds and date format string inputs.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.