first commit
This commit is contained in:
18
lib/services/other_function.dart
Normal file
18
lib/services/other_function.dart
Normal file
@ -0,0 +1,18 @@
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
String commaFormat(int number) {
|
||||
final formatter = NumberFormat('#,###');
|
||||
return formatter.format(number);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user