1 // ========================================================================== 2 // Project: SproutCore - JavaScript Application Framework 3 // Copyright: ©2006-2011 Strobe Inc. and contributors. 4 // Portions ©2008-2011 Apple Inc. All rights reserved. 5 // License: Licensed under MIT license (see license.js) 6 // ========================================================================== 7 8 /** 9 * Returns the ordinal associated for the current number. 10 */ 11 SC.methodForLocale('en', 'ordinalForNumber', function(number) { 12 var d = number % 10; 13 return (~~ (number % 100 / 10) === 1) ? 'th' : 14 (d === 1) ? 'st' : 15 (d === 2) ? 'nd' : 16 (d === 3) ? 'rd' : 'th'; 17 });