2023-07-14 03:31:03 +00:00
|
|
|
import 'package:intl/intl.dart';
|
|
|
|
|
2023-05-18 10:58:21 +00:00
|
|
|
class OtherFunction {
|
|
|
|
int umur(String tanggalLahir) {
|
|
|
|
// change tanggalLahir to DateTime
|
|
|
|
DateTime date = DateTime.parse(tanggalLahir);
|
|
|
|
// get current date
|
|
|
|
DateTime now = DateTime.now();
|
|
|
|
// get difference in year
|
|
|
|
int year = now.year - date.year;
|
|
|
|
return year;
|
|
|
|
}
|
2023-07-14 03:31:03 +00:00
|
|
|
|
|
|
|
String commaFormat(int number) {
|
|
|
|
final formatter = NumberFormat('#,###');
|
|
|
|
return formatter.format(number);
|
|
|
|
}
|
2023-05-18 10:58:21 +00:00
|
|
|
}
|