title: Calculation result wrong in Extendscript Javascript
body: <p>I'm writing a InDesign Script and I'm using moments.js for calculating dates.</p>
  
  <p>When I'm using the date-format "Do", which should return fore example "1st, 2nd, 3rd, 4th...", but the calculation the function does, returns a wrong result and the result is this:</p>
  
  <p>1rd
  2rd
  3rd
  4th
  5th
  6th
  7th
  8th
  9th
  10rd
  11rd
  12rd
  13rd
  14rd
  15rd
  16rd
  17rd
  18rd
  19rd
  20th
  21rd
  22rd
  23rd
  24th
  25th
  26th
  27th
  28th
  29th
  30th
  31rd</p>
  
  <p>This is the function:</p>
  
  <pre><code>function returnOrdinal(number) {
    var b = number % 10,
    output = (parseInt(number % 100 / 10) === 1) ? 'th' :
     (b === 1) ? 'st' :
     (b === 2) ? 'nd' :
     (b === 3) ? 'rd' : 'th';
    return number + output;
  }
  </code></pre>
  
  <p>I created a <a href="https://jsfiddle.net/ms6znuo7/" rel="nofollow">JSFiddle</a> that uses the same function and it returns the correct results.</p>
  
  <p>So is this a known issue in Extendscript? Do you know any other way to return the ordinals? Any workaround?</p>
  
  <p>Thanks in advance</p>