Uploaded image for project: 'Zeppelin'
  1. Zeppelin
  2. ZEPPELIN-2832

An angular error occurs when reading a stored date object

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 0.7.2
    • None
    • front-end
    • None

    Description

      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:

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

      The variable is then stored in note.json as:

           {
              "name": "dateObject",
              "object": "2017-08-01T22:00:00.000Z",
              "noteId": "2CQ2X4TT7",
              "paragraphId": "20170804-135619_1160533068"
            }
      

      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

      Attachments

        Activity

          People

            Unassigned Unassigned
            andreaskdk Andreas Koch
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: