Skip to content

Instantly share code, notes, and snippets.

@iivvoo
Created March 15, 2016 16:04
Show Gist options
  • Save iivvoo/8a86d2e3caedfe59302b to your computer and use it in GitHub Desktop.
Save iivvoo/8a86d2e3caedfe59302b to your computer and use it in GitHub Desktop.
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