Skip to content

Commit

Permalink
Merge pull request #178 from socrata/rjm/more-lenient-date-formats
Browse files Browse the repository at this point in the history
Allow spaces around timestamp formats
  • Loading branch information
rjmac authored Sep 25, 2017
2 parents d7fee14 + d2a2f9d commit af390f1
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ public class ControlFileModel extends Observable {
private CSVModel csvModel;
private DatasetModel datasetModel;
private String path;
final String fieldSeparator = ",";
final String constructingFieldSeparator = ",";
final String deconstructingFieldSeparator = "\\s*,\\s*";

public ControlFileModel (ControlFile file, DatasetModel dataset) throws IOException{
controlFile = file;
Expand Down Expand Up @@ -299,7 +300,7 @@ public String getStringFromArray(String[] array){
for (int i = 0; i < array.length; i++){
strbuf.append(array[i]);
if (i+1 != array.length)
strbuf.append(fieldSeparator);
strbuf.append(constructingFieldSeparator);
}
return strbuf.toString();
}
Expand All @@ -313,13 +314,13 @@ public String getTimezone(){
}

public void setFixedDateTime(String fixed){
String[] newDateTime = fixed.split(fieldSeparator);
String[] newDateTime = fixed.split(deconstructingFieldSeparator);
controlFile.getFileTypeControl().fixedTimestampFormat(newDateTime);
updateListeners();
}

public void setFloatingDateTime(String floating){
String[] newDateTime = floating.split(fieldSeparator);
String[] newDateTime = floating.split(deconstructingFieldSeparator);
controlFile.getFileTypeControl().floatingTimestampFormat(newDateTime);
updateListeners();
}
Expand Down

0 comments on commit af390f1

Please sign in to comment.