[MGNLREST-274] Date types cannot be updated via REST calls Created: 10/Sep/20  Updated: 09/Mar/21  Resolved: 09/Mar/21

Status: Closed
Project: Magnolia REST Framework
Component/s: integration
Affects Version/s: 2.2.2
Fix Version/s: None

Type: Bug Priority: Neutral
Reporter: Richard Gange Assignee: Richard Gange
Resolution: Cannot Reproduce Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
relation
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled

 Description   

When trying to update a property of type Date via REST I always get the time of the call in the field rather than the passed value.

I would expect to be able to update a date property like this (similar to this):

curl http://localhost:8080/magnoliaAuthor/.rest/nodes/v1/website/travel \
-H "Content-Type: application/json" \
-X POST -i \
--user superuser:superuser \
--data \
'{
  "properties": [
    {
      "name": "title",
      "type": "String",
      "values": [
        "Hello REST updated"
      ]
    },
    {
      "name": "date",
      "type": "Date",
      "values": [
        "2020-01-01T11:10:00.000+01:00"
      ]
    }  
  ]
}'

Workaround
Create a command to update the node and call the command via REST.



 Comments   
Comment by Richard Gange [ 09/Mar/21 ]

I was able to fix this by using a different format for date:

curl http://localhost:8080/magnoliaAuthor/.rest/nodes/v1/website/travel \
-H "Content-Type: application/json" \
-X POST -i \
--user superuser:superuser \
--data \
'{
  "properties": [
    {
      "name": "title",
      "type": "String",
      "values": [
        "Hello REST updated"
      ]
    },
    {
      "name": "date",
      "type": "Date",
      "values":["2020-05-01T12:11:25"]
    }  
  ]
}'
Generated at Mon Feb 12 06:58:18 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.