@aws-sdk/protocol-timestamp
Advanced tools
Comparing version 0.1.0-preview.2 to 0.1.0-preview.3
@@ -5,1 +5,2 @@ export declare function iso8601(time: number | string | Date): string; | ||
export declare function toDate(time: number | string | Date): Date; | ||
export declare function formatTimestamp(time: number | string | Date, format: string): number | string; |
@@ -20,2 +20,5 @@ "use strict"; | ||
if (typeof time === 'string') { | ||
if (Number(time)) { | ||
return new Date(Number(time) * 1000); | ||
} | ||
return new Date(time); | ||
@@ -26,2 +29,15 @@ } | ||
exports.toDate = toDate; | ||
function formatTimestamp(time, format) { | ||
switch (format) { | ||
case 'iso8601': | ||
return iso8601(time); | ||
case 'rfc822': | ||
return rfc822(time); | ||
case 'unixTimestamp': | ||
return epoch(time); | ||
default: | ||
throw new Error('Invalid TimestampFormat: ' + format); | ||
} | ||
} | ||
exports.formatTimestamp = formatTimestamp; | ||
//# sourceMappingURL=index.js.map |
@@ -6,4 +6,15 @@ # Change Log | ||
# [0.1.0-preview.3](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/protocol-timestamp@0.1.0-preview.2...@aws-sdk/protocol-timestamp@0.1.0-preview.3) (2019-04-19) | ||
### Features | ||
* timestamp serializing and de-serializing ([#216](https://github.com/aws/aws-sdk-js-v3/issues/216)) ([0556c99](https://github.com/aws/aws-sdk-js-v3/commit/0556c99)) | ||
# [0.1.0-preview.2](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/protocol-timestamp@0.1.0-preview.1...@aws-sdk/protocol-timestamp@0.1.0-preview.2) (2019-03-27) | ||
**Note:** Version bump only for package @aws-sdk/protocol-timestamp |
{ | ||
"name": "@aws-sdk/protocol-timestamp", | ||
"version": "0.1.0-preview.2", | ||
"version": "0.1.0-preview.3", | ||
"description": "A marshaller and unmarshaller for timestamps used by the AWS SDKs", | ||
@@ -18,3 +18,3 @@ "main": "./build/index.js", | ||
"dependencies": { | ||
"@aws-sdk/types": "^0.1.0-preview.2", | ||
"@aws-sdk/types": "^0.1.0-preview.3", | ||
"tslib": "^1.8.0" | ||
@@ -27,4 +27,3 @@ }, | ||
}, | ||
"types": "./build/index.d.ts", | ||
"gitHead": "3dd9e610b159cadf8db49740ee8b0732e0c966e2" | ||
"types": "./build/index.d.ts" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15867
61