You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2018/04/27 16:04:01 UTC

[GitHub] tudordumitriu commented on issue #1295: View MapFunction incorrect date parsing

tudordumitriu commented on issue #1295: View MapFunction incorrect date parsing
URL: https://github.com/apache/couchdb/issues/1295#issuecomment-385016572
 
 
   Hi
   I have attached the full map function (a simplified version but nevertheless buggy)
   ```
   function (doc) {
            if(doc.startDateTime){ 
                var currentDateTime = new Date(doc.startDateTime);          
                emit(currentDateTime, 0);
                var currentOccurenceNo = 0;
                while (currentOccurenceNo < 4) 
                {
                   currentDateTime = new Date(currentDateTime.setDate(currentDateTime.getDate() + 1));
                   emit(currentDateTime, 0);
                   currentOccurenceNo ++;
                }
            }
   }
   ```
   For the document is enough to have a document with startDateTime: "2018-04-24T14:00:00.000Z" and the results are the following:
   
   
   9d18eb2eaf35aed06b5ef334d702e39c | 2018-04-25T14:00:00.000Z | 0 |  
   9d18eb2eaf35aed06b5ef334d702e39c | 2018-04-26T14:00:00.000Z | 0 |  
   9d18eb2eaf35aed06b5ef334d702e39c | 2018-04-27T14:00:00.000Z | 0 |  
   9d18eb2eaf35aed06b5ef334d702e39c | 2018-04-28T14:00:00.000Z | 0 |  
   9d18eb2eaf35aed06b5ef334d702e39c | 2018-04-28T14:00:00.000Z | 0 |
   
   Also, VERY IMPORTANT I THINK, if we comment out the while loop, the initial emit is displaying correctly 
   9d18eb2eaf35aed06b5ef334d702e39c | 2018-04-24T14:00:00.000Z | 0 |
   
   Hope this will help more
   
   
   
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services