Remove special write-only handling for dates
This commit is contained in:
@@ -346,12 +346,8 @@ ol.parser.ogc.Filter_v1 = function() {
|
|||||||
},
|
},
|
||||||
'Literal': function(expr) {
|
'Literal': function(expr) {
|
||||||
goog.asserts.assert(expr instanceof ol.expr.Literal);
|
goog.asserts.assert(expr instanceof ol.expr.Literal);
|
||||||
var value = expr.getValue();
|
|
||||||
if (value instanceof Date) {
|
|
||||||
value = value.toISOString();
|
|
||||||
}
|
|
||||||
var node = this.createElementNS('ogc:Literal');
|
var node = this.createElementNS('ogc:Literal');
|
||||||
node.appendChild(this.createTextNode(value));
|
node.appendChild(this.createTextNode(expr.getValue()));
|
||||||
return node;
|
return node;
|
||||||
},
|
},
|
||||||
'LowerBoundary': function(expr) {
|
'LowerBoundary': function(expr) {
|
||||||
|
|||||||
@@ -234,28 +234,6 @@ describe('ol.parser.ogc.Filter_v1_0_0', function() {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('#date', function() {
|
|
||||||
|
|
||||||
it('date writing works as expected', function(done) {
|
|
||||||
var url = 'spec/ol/parser/ogc/xml/filter_v1_0_0/betweendates.xml';
|
|
||||||
afterLoadXml(url, function(xml) {
|
|
||||||
// ISO 8601: 2010-11-27T18:19:15.123Z
|
|
||||||
var start = new Date(Date.UTC(2010, 10, 27, 18, 19, 15, 123));
|
|
||||||
// ISO 8601: 2011-12-27T18:19:15.123Z
|
|
||||||
var end = new Date(Date.UTC(2011, 11, 27, 18, 19, 15, 123));
|
|
||||||
var filter = new ol.expr.Logical(ol.expr.LogicalOp.AND,
|
|
||||||
new ol.expr.Comparison(ol.expr.ComparisonOp.GTE,
|
|
||||||
new ol.expr.Identifier('when'), new ol.expr.Literal(start)),
|
|
||||||
new ol.expr.Comparison(ol.expr.ComparisonOp.LTE,
|
|
||||||
new ol.expr.Identifier('when'), new ol.expr.Literal(end)));
|
|
||||||
var output = parser.write(filter);
|
|
||||||
expect(goog.dom.xml.loadXml(output)).to.xmleql(xml);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('_expression reader works as expected', function() {
|
describe('_expression reader works as expected', function() {
|
||||||
it('_expression reader handles combined propertyname and literal',
|
it('_expression reader handles combined propertyname and literal',
|
||||||
function() {
|
function() {
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/ogc http://schemas.opengis.net/filter/1.0.0/filter.xsd">
|
|
||||||
<ogc:PropertyIsBetween>
|
|
||||||
<ogc:PropertyName>when</ogc:PropertyName>
|
|
||||||
<ogc:LowerBoundary>
|
|
||||||
<ogc:Literal>2010-11-27T18:19:15.123Z</ogc:Literal>
|
|
||||||
</ogc:LowerBoundary>
|
|
||||||
<ogc:UpperBoundary>
|
|
||||||
<ogc:Literal>2011-12-27T18:19:15.123Z</ogc:Literal>
|
|
||||||
</ogc:UpperBoundary>
|
|
||||||
</ogc:PropertyIsBetween>
|
|
||||||
</ogc:Filter>
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
|
|
||||||
<ogc:PropertyIsBetween>
|
|
||||||
<ogc:PropertyName>when</ogc:PropertyName>
|
|
||||||
<ogc:LowerBoundary>
|
|
||||||
<ogc:Literal>2010-11-27</ogc:Literal>
|
|
||||||
</ogc:LowerBoundary>
|
|
||||||
<ogc:UpperBoundary>
|
|
||||||
<ogc:Literal>2011-12-27</ogc:Literal>
|
|
||||||
</ogc:UpperBoundary>
|
|
||||||
</ogc:PropertyIsBetween>
|
|
||||||
</ogc:Filter>
|
|
||||||
Reference in New Issue
Block a user