Skip to content

Commit

Permalink
Note the use of UTC or local time zones where appropriate (to address…
Browse files Browse the repository at this point in the history
… half of #25)
  • Loading branch information
Dermah committed Feb 8, 2016
1 parent 7f8f4e5 commit ab070f1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/EC2Store.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class EC2Store {
snap.Name = snapResponse.SnapshotId;
snap.SnapshotId = snapResponse.SnapshotId;
snap.FromVolumeId = snapResponse.VolumeId;
// NOTE: Ingesting date value with it's time zone (ZZ)
snap.StartTime = moment(snapResponse.StartTime, 'ddd MMM DD YYYY HH:mm:ss ZZ');
snap.FromVolumeName = undefined;
snap.BackupType = undefined;
Expand Down Expand Up @@ -82,6 +83,7 @@ class EC2Store {
// Check the expiry date is in YYYYMMDDHHmmss format (14 digits)
if (key === 'ExpiryDate') {
if (new RegExp(`^\\d{${EXPIRY_DATE_FORMAT.length}}$`).test(value)) {
// NOTE: Ingest date as a UTC date using moment.utc()
if (moment.utc(value, EXPIRY_DATE_FORMAT).isValid()) {
snap.ExpiryDate = moment.utc(value, EXPIRY_DATE_FORMAT).local();
} else {
Expand Down

0 comments on commit ab070f1

Please sign in to comment.