Compare commits
No commits in common. "3d43d7a93491f6436b0a057999d7cacd2fefa18d" and "43153f9b0d253c58fab9f4a23b17e4c09986e1b2" have entirely different histories.
3d43d7a934
...
43153f9b0d
@ -1,33 +0,0 @@
|
|||||||
part of 'extension.dart';
|
|
||||||
|
|
||||||
extension DateTimeIndonesia on DateTime {
|
|
||||||
/// Format: 13 Agustus 2025
|
|
||||||
String get toDate {
|
|
||||||
return DateFormat('d MMMM yyyy', 'id_ID').format(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Format: 13 Agustus 2025 20:00
|
|
||||||
String get toDatetime {
|
|
||||||
return DateFormat('d MMMM yyyy HH:mm', 'id_ID').format(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Format: Rabu, 13 Agustus 2025
|
|
||||||
String get toDayDate {
|
|
||||||
return DateFormat('EEEE, d MMMM yyyy', 'id_ID').format(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Format: 13/08/2025
|
|
||||||
String get toShortDate {
|
|
||||||
return DateFormat('dd/MM/yyyy', 'id_ID').format(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Format: 13-08-2025
|
|
||||||
String get toServerDate {
|
|
||||||
return DateFormat('dd-MM-yyyy', 'id_ID').format(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Format jam: 14:30
|
|
||||||
String get toHourMinute {
|
|
||||||
return DateFormat('HH:mm', 'id_ID').format(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,5 +1 @@
|
|||||||
import 'package:intl/intl.dart';
|
// TODO: define your code
|
||||||
|
|
||||||
part 'int_extension.dart';
|
|
||||||
part 'date_extension.dart';
|
|
||||||
part 'string_extension.dart';
|
|
||||||
|
|||||||
@ -1,9 +0,0 @@
|
|||||||
part of 'extension.dart';
|
|
||||||
|
|
||||||
extension IntegerExt on int {
|
|
||||||
String get currencyFormatRp => NumberFormat.currency(
|
|
||||||
locale: 'id',
|
|
||||||
symbol: 'Rp. ',
|
|
||||||
decimalDigits: 0,
|
|
||||||
).format(this);
|
|
||||||
}
|
|
||||||
@ -1,28 +0,0 @@
|
|||||||
part of 'extension.dart';
|
|
||||||
|
|
||||||
extension StringExt on String {
|
|
||||||
int get toIntegerFromText {
|
|
||||||
final cleanedText = replaceAll(RegExp(r'[^0-9]'), '');
|
|
||||||
final parsedValue = int.tryParse(cleanedText) ?? 0;
|
|
||||||
return parsedValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
String get currencyFormatRpV2 {
|
|
||||||
final parsedValue = int.tryParse(this) ?? 0;
|
|
||||||
return NumberFormat.currency(
|
|
||||||
locale: 'id',
|
|
||||||
symbol: 'Rp. ',
|
|
||||||
decimalDigits: 0,
|
|
||||||
).format(parsedValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
String get toTitleCase {
|
|
||||||
if (isEmpty) return '';
|
|
||||||
return split(' ')
|
|
||||||
.map((word) {
|
|
||||||
if (word.isEmpty) return '';
|
|
||||||
return word[0].toUpperCase() + word.substring(1).toLowerCase();
|
|
||||||
})
|
|
||||||
.join(' ');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user