Subversion Repositories SmartDukaan

Rev

Rev 31703 | Rev 32603 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 31703 Rev 32308
Line 7... Line 7...
7
import java.time.LocalDate;
7
import java.time.LocalDate;
8
import java.time.LocalDateTime;
8
import java.time.LocalDateTime;
9
import java.time.format.DateTimeFormatter;
9
import java.time.format.DateTimeFormatter;
10
import java.util.Locale;
10
import java.util.Locale;
11
 
11
 
-
 
12
import static com.google.gson.internal.$Gson$Preconditions.checkArgument;
-
 
13
 
12
public class FormattingUtils {
14
public class FormattingUtils {
13
 
15
 
14
	private static final NumberFormat currencyFormatter = NumberFormat.getCurrencyInstance(new Locale("en", "IN"));
16
	private static final NumberFormat currencyFormatter = NumberFormat.getCurrencyInstance(new Locale("en", "IN"));
15
	private static final NumberFormat numberFormatter = NumberFormat.getNumberInstance(new Locale("en", "IN"));
17
	private static final NumberFormat numberFormatter = NumberFormat.getNumberInstance(new Locale("en", "IN"));
16
	private static final NumberFormat digitFormatter = NumberFormat.getNumberInstance(new Locale("en", "IN"));
18
	private static final NumberFormat digitFormatter = NumberFormat.getNumberInstance(new Locale("en", "IN"));
Line 127... Line 129...
127
 
129
 
128
	public static double serialize(BigDecimal value) {
130
	public static double serialize(BigDecimal value) {
129
		value = value.setScale(2, RoundingMode.HALF_UP);
131
		value = value.setScale(2, RoundingMode.HALF_UP);
130
		return value.doubleValue();
132
		return value.doubleValue();
131
	}
133
	}
-
 
134
 
-
 
135
	// https://github.com/google/guava
-
 
136
	String getDayOfMonthSuffix(final int n) {
-
 
137
		checkArgument(n >= 1 && n <= 31);
-
 
138
		if (n >= 11 && n <= 13) {
-
 
139
			return "th";
-
 
140
		}
-
 
141
		switch (n % 10) {
-
 
142
			case 1:
-
 
143
				return "st";
-
 
144
			case 2:
-
 
145
				return "nd";
-
 
146
			case 3:
-
 
147
				return "rd";
-
 
148
			default:
-
 
149
				return "th";
-
 
150
		}
-
 
151
	}
132
}
152
}