[ 
https://issues.apache.org/jira/browse/COUCHDB-697?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

thanos vassilakis updated COUCHDB-697:
--------------------------------------

    Description: 
Simple test:

{code:javascript}
function(doc) { 
var today = new Date();
var month = new Date(today.getYear(), today.getMonth(),1);
emit(today.getYear(), month);
}
{code}

results in :
{noformat}
110
ID: 9eb7affe00e4b705afa4679fa70c5938    "0110-03-01T05:00:00.000Z"
110
ID: 9eb7affe00e4b705afa4679fa70c53ec    "0110-03-01T05:00:00.000Z"
110
ID: 9eb7affe00e4b705afa4679fa70c4c93    "0110-03-01T05:00:00.000Z"
110
ID: 9eb7affe00e4b705afa4679fa70c3d13    "0110-03-01T05:00:00.000Z"
110
ID: 9eb7affe00e4b705afa4679fa70c333e    "0110-03-01T05:00:00.000Z"
{noformat}
Using Opera:
{code:javascript}
javascript:var today= new Date(); today.getYear();
{code}

Results in:
{noformat}
2010
{noformat}




  was:
Simple test:
function(doc) { 
var today = new Date();
var month = new Date(today.getYear(), today.getMonth(),1);

if (doc.date) {
         var date = new Date(doc.date);
         if (date > month && date < today)
                emit(today.getYear(), month);
}
}

results in :

110
ID: 9eb7affe00e4b705afa4679fa70c5938    "0110-03-01T05:00:00.000Z"
110
ID: 9eb7affe00e4b705afa4679fa70c53ec    "0110-03-01T05:00:00.000Z"
110
ID: 9eb7affe00e4b705afa4679fa70c4c93    "0110-03-01T05:00:00.000Z"
110
ID: 9eb7affe00e4b705afa4679fa70c3d13    "0110-03-01T05:00:00.000Z"
110
ID: 9eb7affe00e4b705afa4679fa70c333e    "0110-03-01T05:00:00.000Z"

Using Opera:

javascript:var today= new Date(); today.getYear();

Results in:
2010






Simplifing the description code

> today.getYear() -> 110 not 2010
> -------------------------------
>
>                 Key: COUCHDB-697
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-697
>             Project: CouchDB
>          Issue Type: Bug
>          Components: JavaScript View Server
>    Affects Versions: 0.10.1
>         Environment: windows NT, couch-0.11.0b905538
>            Reporter: thanos vassilakis
>
> Simple test:
> {code:javascript}
> function(doc) { 
> var today = new Date();
> var month = new Date(today.getYear(), today.getMonth(),1);
> emit(today.getYear(), month);
> }
> {code}
> results in :
> {noformat}
> 110
> ID: 9eb7affe00e4b705afa4679fa70c5938  "0110-03-01T05:00:00.000Z"
> 110
> ID: 9eb7affe00e4b705afa4679fa70c53ec  "0110-03-01T05:00:00.000Z"
> 110
> ID: 9eb7affe00e4b705afa4679fa70c4c93  "0110-03-01T05:00:00.000Z"
> 110
> ID: 9eb7affe00e4b705afa4679fa70c3d13  "0110-03-01T05:00:00.000Z"
> 110
> ID: 9eb7affe00e4b705afa4679fa70c333e  "0110-03-01T05:00:00.000Z"
> {noformat}
> Using Opera:
> {code:javascript}
> javascript:var today= new Date(); today.getYear();
> {code}
> Results in:
> {noformat}
> 2010
> {noformat}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to