28 lines
709 B
Dart
28 lines
709 B
Dart
import 'package:cloud_firestore/cloud_firestore.dart';
|
|
import 'package:intl/intl.dart';
|
|
|
|
class DateUtil {
|
|
static DateTime toLocal(DateTime dt) {
|
|
return dt.add(Duration(hours: 6, minutes: 30));
|
|
}
|
|
|
|
static DateTime fromTimestampToLocalDate(Timestamp ts) {
|
|
if (ts == null) return null;
|
|
return toLocal(ts.toDate());
|
|
}
|
|
}
|
|
|
|
String updatePhoneNumber(String phoneNumber) {
|
|
if (phoneNumber == null) return null;
|
|
if (phoneNumber.startsWith("09")) {
|
|
return "959" + phoneNumber.substring(2);
|
|
}
|
|
return phoneNumber;
|
|
}
|
|
|
|
final NumberFormat numberFormatter = new NumberFormat("#,###");
|
|
String formatNumber(int number) {
|
|
if (number == null) return "";
|
|
return numberFormatter.format(number);
|
|
}
|