Merge pull request #34 from kyleconroy/correct-amz-credential-date

Generate correct date for AMZ credentials.
This commit is contained in:
igorkofman
2015-10-28 08:44:58 -07:00

View File

@@ -122,8 +122,8 @@ function getS3PolicyAndSig(domain, localPadId, userId) {
var expirationDate = new Date(); var expirationDate = new Date();
expirationDate.setDate(expirationDate.getDate() + 1); expirationDate.setDate(expirationDate.getDate() + 1);
function pad(n) { return n < 10 ? '0' + n : n } function pad(n) { return n < 10 ? '0' + n.toString() : n.toString() }
var utcDateStr = expirationDate.getUTCFullYear() + var utcDateStr = pad(expirationDate.getUTCFullYear()) +
pad(expirationDate.getUTCMonth() + 1) + pad(expirationDate.getUTCMonth() + 1) +
pad(expirationDate.getUTCDate()); pad(expirationDate.getUTCDate());