Created
March 15, 2016 16:04
-
-
Save iivvoo/8a86d2e3caedfe59302b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class EmberDateField(serializers.DateField): | |
def to_internal_value(self, value): | |
value = value.split('T', 1)[0] | |
return super().to_internal_value(value) | |
def to_representation(self, value): | |
res = super().to_representation(value) | |
# XXX This is a hack - assumes CET timezone, which is 1 hour | |
# later than UTC. CET gets stored as 'day before 23:00' so we | |
# need to restore that part again | |
return res + 'T23:00:00.000Z' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment