Bugfix: S3 time precision issue fixed (#3182)

* Bugfix: S3 time precision issue fixed

* Bugfix: S3 time precision issue fixed

* s3 timeformat fix

* Quickfix S3 timefix
This commit is contained in:
Macwan Nevil 2020-07-26 15:00:15 +00:00 committed by GitHub
parent 2504a398f9
commit c166d97a97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View File

@ -190,6 +190,12 @@ def iso_8601_datetime_without_milliseconds(datetime):
return None if datetime is None else datetime.strftime("%Y-%m-%dT%H:%M:%S") + "Z"
def iso_8601_datetime_without_milliseconds_s3(datetime):
return (
None if datetime is None else datetime.strftime("%Y-%m-%dT%H:%M:%S.000") + "Z"
)
RFC1123 = "%a, %d %b %Y %H:%M:%S GMT"

View File

@ -22,7 +22,7 @@ import six
from bisect import insort
from moto.core import ACCOUNT_ID, BaseBackend, BaseModel
from moto.core.utils import iso_8601_datetime_with_milliseconds, rfc_1123_datetime
from moto.core.utils import iso_8601_datetime_without_milliseconds_s3, rfc_1123_datetime
from moto.cloudwatch.models import MetricDatum
from moto.utilities.tagging_service import TaggingService
from .exceptions import (
@ -79,7 +79,7 @@ class FakeDeleteMarker(BaseModel):
@property
def last_modified_ISO8601(self):
return iso_8601_datetime_with_milliseconds(self.last_modified)
return iso_8601_datetime_without_milliseconds_s3(self.last_modified)
@property
def version_id(self):
@ -206,7 +206,7 @@ class FakeKey(BaseModel):
@property
def last_modified_ISO8601(self):
return iso_8601_datetime_with_milliseconds(self.last_modified)
return iso_8601_datetime_without_milliseconds_s3(self.last_modified)
@property
def last_modified_RFC1123(self):