I have an angular front end with D8 backend. I am populating a content type that has a Date field. I am successfully creating the content-type with the all its fields including the Date field. The format I am sending via POST looks like 2017-07-07. It gets saved and I can even retrieve the data.

The problem is when I edit or view the node via drupal admin, the date field is empty. If I devel the node, the value I sent is set on the field. It just will not display via in drupal. What format should I be sending the date field so it will save and populate the form.

In JS, I am sending the date like so:

var start = new Date();
var params = {
  start: {value: start.getFullYear() + '-' + (start.getMonth() + 1) + '-' + start.getDate()}
$http.post(API + 'entity/node', params); //etc
  • If you create the node (with a date field) via the Drupal UI, then do a GET on that node via REST, what does the structure of the date field look like? Commented Jul 8, 2017 at 22:56
  • @tyler.frankenstein good point...appears to look like: 2017-07-21T18:11:11
    – Ronnie
    Commented Jul 10, 2017 at 18:26
  • What is the machine name of your date field? Perhaps something like field_start...? Commented Jul 11, 2017 at 0:36
  • @tyler.frankenstein yes it is field_start. It looks like it is expecting a time stamp as well as date. it looks like maybe a 24hr format?
    – Ronnie
    Commented Jul 11, 2017 at 16:55
  • What if you try POSTing something like this then in your params: "field_start":[{"value":"2017-07-21T18:11:11"}] ? Commented Jul 11, 2017 at 20:25

1 Answer 1


To set a Date Field via REST in Drupal 8, you can do this:

// Build the JSON payload.
var node = {
  "title":[{"value":"Hello World"}],

// Then POST the payload to Drupal...
$http.post('https://example.com/entity/node', node);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.