Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
erp5 erp5
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Labels
    • Labels
  • Merge requests 139
    • Merge requests 139
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Environments
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Jobs
  • Commits
Collapse sidebar
  • nexedi
  • erp5erp5
  • Merge requests
  • !1053

The source project of this merge request has been removed.
Closed
Created Feb 18, 2020 by Yusei Tahara@yuseiOwner
  • Report abuse
Report abuse

WIP: erp5_web_renderjs_ui: Change date separator from a dash to a slash before sending query to Zope

  • Overview 12
  • Changes 1

Zope DateTime uses local timezone automatically if date seperator was a slash like 2020/02/08, but if it was a dash like 2020-02-08, Zope DateTime ignores local timezone and timezone become GMT+0. Then if server is not located in GMT+0 zone, date search does not work. Since HTML5 date input field uses dash as a separator, it must be changed to slash before sending query to Zope.

# Server timezone is GMT+9.
>> print DateTime('2020-02-18')
2020/02/18 00:00:00 GMT+0
>> print DateTime('2020/02/18')
2020/02/18 00:00:00 GMT+9
#
# Server timezone is GMT+9
# context.portal_catalog(effective_date='2020-02-18', src__=1)
#
SELECT DISTINCT
   catalog.path,   catalog.uid    
FROM
      (
    catalog AS `catalog`
  INNER JOIN
    versioning AS `versioning`
  ON
    `versioning`.`uid` = `catalog`.`uid`
  )
  
WHERE 
  1 = 1 
  AND ((`versioning`.`effective_date` >= "2020-02-18 00:00:00"
  AND `versioning`.`effective_date` < "2020-02-19 00:00:00")
  AND (`catalog`.`viewable_owner` = 'zope'
  OR `catalog`.`security_uid` IN (17, 20, 23, 24, 25, 28, 29, 30, 31, 32, 33, 34, 35, 36, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51)))
#
# Server timezone is GMT+9
# context.portal_catalog(effective_date='2020/02/18', src__=1)
#
SELECT DISTINCT
   catalog.path,   catalog.uid    
FROM
      (
    catalog AS `catalog`
  INNER JOIN
    versioning AS `versioning`
  ON
    `versioning`.`uid` = `catalog`.`uid`
  )
  
WHERE 
  1 = 1 
  AND ((`versioning`.`effective_date` >= "2020-02-17 15:00:00"
  AND `versioning`.`effective_date` < "2020-02-18 15:00:00")
  AND (`catalog`.`viewable_owner` = 'zope'
  OR `catalog`.`security_uid` IN (17, 20, 23, 24, 25, 28, 29, 30, 31, 32, 33, 34, 35, 36, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51)))

@romain Could you review this MR?

Assignee
Assign to
Reviewer
Request review from
None
Milestone
None
Assign milestone
Time tracking
Source branch: erp5js_searcheditor_date_bug
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7