Andreas Koch created ZEPPELIN-2832:
--------------------------------------

             Summary: An angular error occurs when reading a stored date object
                 Key: ZEPPELIN-2832
                 URL: https://issues.apache.org/jira/browse/ZEPPELIN-2832
             Project: Zeppelin
          Issue Type: Bug
          Components: front-end
    Affects Versions: 0.7.2
            Reporter: Andreas Koch


The following is my interpretation of what is going on, but please note that I 
am not very familiar with angular, so I may very well be wrong.

If an input form with a field of type "date" is bound to an angular variable an 
error occurs when the stored variable is later read from the note.json file. I 
think, this is because the variable is stored as a string and that string and 
angular does not convert the string back to a date.

The error can be reproduced by creating a paragraph like this:

{code:javascript}
%angular

Test date: <input type='date' ng-model='dateObject'></input>
<button 
ng-click="z.angularBind('dateObject',dateObject,'20170804-135511_834695103');">Bind</button>
{code}

The variable is then stored in note.json as:
{code:javascript}
     {
        "name": "dateObject",
        "object": "2017-08-01T22:00:00.000Z",
        "noteId": "2CQ2X4TT7",
        "paragraphId": "20170804-135619_1160533068"
      }
{code}

But when the variable is reloaded from the note.json file an error occurs:

Error: [ngModel:datefmt] Expected `2017-07-03T22:00:00.000Z` to be a date
http://errors.angularjs.org/1.5.0/ngModel/datefmt?p0=2017-07-03T22%3A00%3A00.000Z
    at vendor.e3a582fbf25541aa.js:34
    at Array.<anonymous> (vendor.e3a582fbf25541aa.js:34)
    at vendor.e3a582fbf25541aa.js:34
    at n.$digest (vendor.e3a582fbf25541aa.js:34)
    at n.$apply (vendor.e3a582fbf25541aa.js:34)
    at vendor.e3a582fbf25541aa.js:34
    at e (vendor.e3a582fbf25541aa.js:34)
    at vendor.e3a582fbf25541aa.js:34



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to