Opened 7 years ago

Closed 6 years ago

Last modified 6 years ago

#17068 closed defect (fixed)

SimpleQueryEngine does not sort on dates properly

Reported by: Colin Snover Owned by: Kris Zyp
Priority: high Milestone: 1.7.6
Component: Data Version: 1.7.5
Keywords: Cc:
Blocked By: Blocking:

Description

Attempting to use SimpleQueryEngine to sort on Date values does not work properly because two Date objects that represent the same date are non-equal.

One potential reasonable solution is to sort using the valueOf of a thing, if one exists:

for (var sort, i = 0; (sort = sortSet[i]); i++) {
	var aValue = a[sort.attribute];
	var bValue = b[sort.attribute];
	// Use valueOf to enable proper comparison of Dates
	aValue = aValue.valueOf ? aValue.valueOf() : aValue;
	bValue = bValue.valueOf ? bValue.valueOf() : bValue;
	if (aValue != bValue) {
		return (Boolean(sort.descending) === (aValue == null || aValue > bValue)) ? -1 : 1;
	}
}
return 0;

Change History (7)

comment:1 Changed 7 years ago by Colin Snover

Milestone: 1.9.11.9.2

1.9.1 is released; moving all outstanding tickets to next milestone.

comment:2 Changed 6 years ago by Colin Snover <github.com@…>

Resolution: fixed
Status: newclosed

In 682f5d0dfeb4833842d476e6d8da946f6eb97e0f/dojo:

Error: Processor CommitTicketReference failed
Unsupported version control system "git": Can't find an appropriate component, maybe the corresponding plugin was not enabled? 

comment:3 Changed 6 years ago by Colin Snover <github.com@…>

In 35032e6de8d6b36417382b68c72f893c13c15b64/dojo:

Error: Processor CommitTicketReference failed
Unsupported version control system "git": Can't find an appropriate component, maybe the corresponding plugin was not enabled? 

comment:4 Changed 6 years ago by Colin Snover <github.com@…>

In 478b7be9e4182458d5451e1844bb25a7d61c0253/dojo:

Error: Processor CommitTicketReference failed
Unsupported version control system "git": Can't find an appropriate component, maybe the corresponding plugin was not enabled? 

comment:5 Changed 6 years ago by Colin Snover <github.com@…>

In 2d440d7b0d32d93f66211e5cb732b3979c6855a8/dojo:

Error: Processor CommitTicketReference failed
Unsupported version control system "git": Can't find an appropriate component, maybe the corresponding plugin was not enabled? 

comment:6 Changed 6 years ago by Colin Snover

Version: 1.8.31.7.5

comment:7 Changed 6 years ago by Colin Snover

Milestone: 1.9.21.7.6
Note: See TracTickets for help on using tickets.