- Timestamp:
- 2021-07-10T23:26:59+02:00 (4 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/OverpassDownloadReader.java
r17982 r17988 46 46 import org.openstreetmap.josm.tools.UncheckedParseException; 47 47 import org.openstreetmap.josm.tools.Utils; 48 import org.openstreetmap.josm.tools.date.DateUtils; 48 49 49 50 /** … … 243 244 } 244 245 245 static String date(String humanDuration, LocalDateTime from) { 246 static String date(String dateOrHumanDuration, LocalDateTime from) { 247 try { 248 return DateUtils.parseInstant(dateOrHumanDuration).toString(); 249 } catch (UncheckedParseException e) { 250 Logging.trace(e); 251 } 252 return duration(dateOrHumanDuration, from); 253 } 254 255 static String duration(String humanDuration, LocalDateTime from) { 246 256 // Convert to ISO 8601. Replace months by X temporarily to avoid conflict with minutes 247 257 String duration = humanDuration.toLowerCase(Locale.ENGLISH).replace(" ", "") -
trunk/src/org/openstreetmap/josm/tools/SearchCompilerQueryWizard.java
r17982 r17988 104 104 final String value = ((SearchCompiler.KeyValue) match).getValue(); 105 105 if ("newer".equals(key)) { 106 return "(newer:" + quote( value) + ")";106 return "(newer:" + quote("{{date:" + value + "}}") + ")"; 107 107 } 108 108 return "[~" + quote(key) + "~" + quote(value) + "]"; -
trunk/test/unit/org/openstreetmap/josm/io/OverpassDownloadReaderTest.java
r17336 r17988 120 120 @Test 121 121 public void testDateNewer() { 122 finalString query = getExpandedQuery("type:node and newer:3minutes");122 String query = getExpandedQuery("type:node and newer:3minutes"); 123 123 String statement = query.substring(query.indexOf("node(newer:\"") + 12, query.lastIndexOf("\");")); 124 assertNotNull(DateUtils.fromString(statement)); 125 126 query = getExpandedQuery("type:node and newer:\"2021-05-30T20:00:00Z\""); 127 statement = query.substring(query.indexOf("node(newer:\"") + 12, query.lastIndexOf("\");")); 124 128 assertNotNull(DateUtils.fromString(statement)); 125 129 } -
trunk/test/unit/org/openstreetmap/josm/tools/SearchCompilerQueryWizardTest.java
r17982 r17988 221 221 @Test 222 222 void testNewer() { 223 assertQueryEquals(" nwr(newer:\"2021-05-30T20:00:00Z\");\n", 223 assertQueryEquals(" nwr(newer:\"{{date:3minutes}}\");\n", 224 "newer:3minutes"); 225 226 assertQueryEquals(" nwr(newer:\"{{date:2021-05-30T20:00:00Z}}\");\n", 224 227 "newer:\"2021-05-30T20:00:00Z\""); 225 228 }
Note:
See TracChangeset
for help on using the changeset viewer.