dbarbalato / magellan

JavaScript Latitude and Longitude Validation and Formatting
18 stars 12 forks source link

toDM and toDMS output should not have trailing zeros. #12

Open evdb opened 8 years ago

evdb commented 8 years ago

Is there a reason for having the trailing zeros as a result of the toFixed calls? I think that they make the output less readable.

Ideally this added to the test suite should pass:

var test_coords = magellan('1° 2\' 3.3" N');
assert.equal('1°2.055\'N',  test_coords.toDM());  // currently 1°2.0550'N
assert.equal('1°2\'3.3"N"', test_coords.toDMS()); // currently 1°2'3.3000"N
captivationsoftware commented 8 years ago

I don't have a strong opinion either way here...