Ticket #16995: josm-cosmetic-fix-for-GPX-date-strings.patch
File josm-cosmetic-fix-for-GPX-date-strings.patch, 2.0 KB (added by , 6 years ago) |
---|
-
src/org/openstreetmap/josm/gui/layer/gpx/ConvertFromGpxLayerAction.java
42 42 public class ConvertFromGpxLayerAction extends ConvertToDataLayerAction<GpxLayer> { 43 43 44 44 private static final String GPX_SETTING = "gpx.convert-tags"; 45 private final DateFormat timeFormatter = DateUtils.getGpxFormat();46 45 47 46 /** 48 47 * Creates a new {@code FromGpxLayer}. … … 82 81 // timestamps should always be converted 83 82 Date date = (Date) obj; 84 83 if (!none) { //... but the tag will only be set when required 85 n.put(key, timeFormatter.format(date));84 n.put(key, DateUtils.fromDate(date)); 86 85 } 87 86 n.setTimestamp(date); 88 87 } -
src/org/openstreetmap/josm/io/GpxWriter.java
37 37 */ 38 38 public class GpxWriter extends XmlWriter implements GpxConstants { 39 39 40 private final DateFormat gpxFormat = DateUtils.getGpxFormat();41 42 40 /** 43 41 * Constructs a new {@code GpxWriter}. 44 42 * @param out The output writer … … 120 118 } else { 121 119 Object val = obj.get(key); 122 120 if (val instanceof Date) { 123 simpleTag(key, gpxFormat.format(val));121 simpleTag(key, DateUtils.fromDate((Date) val)); 124 122 } else if (val instanceof Number) { 125 123 simpleTag(key, val.toString()); 126 124 } else if (val != null) {