| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 class SplitDecimal { | 5 class SplitDecimal { |
| 6 String fracPart; | 6 String fracPart; |
| 7 String intPart; | 7 String intPart; |
| 8 bool isNegative; | 8 bool isNegative; |
| 9 | 9 |
| 10 String get lparen() => isNegative ? "(" : ""; | 10 String get lparen() => isNegative ? "(" : ""; |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 | 217 |
| 218 _numericFormats.add(String _(double x) { | 218 _numericFormats.add(String _(double x) { |
| 219 Date dt = DateUtils.getDateTime(x); | 219 Date dt = DateUtils.getDateTime(x); |
| 220 return "${_monthNames[dt.month - 1]} ${dt.day}, ${dt.year}"; | 220 return "${_monthNames[dt.month - 1]} ${dt.day}, ${dt.year}"; |
| 221 }); | 221 }); |
| 222 _numericFormatDescriptions.add("Month Day, Year"); // 11 | 222 _numericFormatDescriptions.add("Month Day, Year"); // 11 |
| 223 | 223 |
| 224 _numericFormats.add(String _(double x) { | 224 _numericFormats.add(String _(double x) { |
| 225 x -= x.floor(); // ignore days | 225 x -= x.floor(); // ignore days |
| 226 Date dt = DateUtils.getDateTime(x); | 226 Date dt = DateUtils.getDateTime(x); |
| 227 String hh = StringUtils.twoDigits(dt.hours); | 227 String hh = StringUtils.twoDigits(dt.hour); |
| 228 String mm = StringUtils.twoDigits(dt.minutes); | 228 String mm = StringUtils.twoDigits(dt.minute); |
| 229 String ss = StringUtils.twoDigits(dt.seconds); | 229 String ss = StringUtils.twoDigits(dt.second); |
| 230 return "${hh}:${mm}:${ss}"; | 230 return "${hh}:${mm}:${ss}"; |
| 231 }); | 231 }); |
| 232 _numericFormatDescriptions.add("HH:MM:SS (Time)"); // 12 | 232 _numericFormatDescriptions.add("HH:MM:SS (Time)"); // 12 |
| 233 | 233 |
| 234 _numericFormats.add(String _(double x) { | 234 _numericFormats.add(String _(double x) { |
| 235 Date dt = DateUtils.getDateTime(x); | 235 Date dt = DateUtils.getDateTime(x); |
| 236 String hh = StringUtils.twoDigits(dt.hours); | 236 String hh = StringUtils.twoDigits(dt.hour); |
| 237 String mm = StringUtils.twoDigits(dt.minutes); | 237 String mm = StringUtils.twoDigits(dt.minute); |
| 238 String ss = StringUtils.twoDigits(dt.seconds); | 238 String ss = StringUtils.twoDigits(dt.second); |
| 239 return "${dt.month}/${dt.day}/${dt.year} ${hh}:${mm}:${ss}"; | 239 return "${dt.month}/${dt.day}/${dt.year} ${hh}:${mm}:${ss}"; |
| 240 }); | 240 }); |
| 241 _numericFormatDescriptions.add("MM/DD/YYYY HH:MM:SS"); // 13 | 241 _numericFormatDescriptions.add("MM/DD/YYYY HH:MM:SS"); // 13 |
| 242 | 242 |
| 243 _numericFormats.add(String _(double x) { | 243 _numericFormats.add(String _(double x) { |
| 244 double days = x.floor(); | 244 double days = x.floor(); |
| 245 x -= days; | 245 x -= days; |
| 246 Date dt = DateUtils.getDateTime(x); | 246 Date dt = DateUtils.getDateTime(x); |
| 247 String mm = StringUtils.twoDigits(dt.minutes); | 247 String mm = StringUtils.twoDigits(dt.minute); |
| 248 String ss = StringUtils.twoDigits(dt.seconds); | 248 String ss = StringUtils.twoDigits(dt.second); |
| 249 return "${24 * days + dt.hours}:${mm}:${ss}"; | 249 return "${24 * days + dt.hour}:${mm}:${ss}"; |
| 250 }); | 250 }); |
| 251 _numericFormatDescriptions.add("HH:MM:SS (Hours)"); // 14 | 251 _numericFormatDescriptions.add("HH:MM:SS (Hours)"); // 14 |
| 252 | 252 |
| 253 _numericFormats.add((double x) => x == 0.0 ? "FALSE" : "TRUE"); | 253 _numericFormats.add((double x) => x == 0.0 ? "FALSE" : "TRUE"); |
| 254 _numericFormatDescriptions.add("TRUE/FALSE"); // 15 | 254 _numericFormatDescriptions.add("TRUE/FALSE"); // 15 |
| 255 | 255 |
| 256 _textFormatDescriptions = new List<String>(); | 256 _textFormatDescriptions = new List<String>(); |
| 257 _textFormatDescriptions.add("--"); | 257 _textFormatDescriptions.add("--"); |
| 258 _textFormatDescriptions.add("B"); // 1 | 258 _textFormatDescriptions.add("B"); // 1 |
| 259 _textFormatDescriptions.add("I"); // 2 | 259 _textFormatDescriptions.add("I"); // 2 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 290 } | 290 } |
| 291 } | 291 } |
| 292 | 292 |
| 293 // Return the numeric formatting function with the given index | 293 // Return the numeric formatting function with the given index |
| 294 NumericFormat getNumericFormat(int index) => _numericFormats[index]; | 294 NumericFormat getNumericFormat(int index) => _numericFormats[index]; |
| 295 | 295 |
| 296 String getNumericFormatDescription(int index) => _numericFormatDescriptions[in
dex]; | 296 String getNumericFormatDescription(int index) => _numericFormatDescriptions[in
dex]; |
| 297 | 297 |
| 298 String getTextFormatDescription(int index) => _textFormatDescriptions[index]; | 298 String getTextFormatDescription(int index) => _textFormatDescriptions[index]; |
| 299 } | 299 } |
| OLD | NEW |