Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • cubicweb cubicweb
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 197
    • Issues 197
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 15
    • Merge requests 15
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • cubicweb
  • cubicwebcubicweb
  • Issues
  • #51

Closed
Open
Created Jun 09, 2020 by Frank Bessou@fbessou🍁Maintainer

CubicWebJsonEncoder incorrectly serialize datetimes with timezones

When calling cubicweb.utils.json_dumps on a date with timezone I would expect to have the timezone serialized in the output string but the timezone is omitted. This will be blocking for application which use the rqlcontroller (through cwclientlib or cwclientlibjs) and rely on datetime with timezones.

import psycopg2.tz
import datetime                                                                                                                
dt = datetime.datetime(2020, 6, 9, 16, 8, 48, 945851, tzinfo=psycopg2.tz.FixedOffsetTimezone(offset=4, name=None))              
str(dt) # '2020-06-09 16:08:48.945851+00:04'                                                        
json_dumps(dt) # '"2020/06/09 16:08:48"'                                                                                                              

We could add a rule to handle datetime with timezones

Maybe we should start by migrating to ISO 8601 to avoid building applications on the current serialization and having to migrate all of them later.

Edited Jun 09, 2020 by Frank Bessou
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking