feat: int and string extension

This commit is contained in:
efrilm
2025-08-13 00:26:59 +07:00
parent e732a27914
commit 3d43d7a934
4 changed files with 49 additions and 8 deletions
+7 -7
View File
@@ -1,33 +1,33 @@
import 'package:intl/intl.dart';
part of 'extension.dart';
extension DateTimeIndonesia on DateTime {
/// Format: 13 Agustus 2025
String toDate() {
String get toDate {
return DateFormat('d MMMM yyyy', 'id_ID').format(this);
}
/// Format: 13 Agustus 2025 20:00
String toDatetime() {
String get toDatetime {
return DateFormat('d MMMM yyyy HH:mm', 'id_ID').format(this);
}
/// Format: Rabu, 13 Agustus 2025
String toDayDate() {
String get toDayDate {
return DateFormat('EEEE, d MMMM yyyy', 'id_ID').format(this);
}
/// Format: 13/08/2025
String toShortDate() {
String get toShortDate {
return DateFormat('dd/MM/yyyy', 'id_ID').format(this);
}
/// Format: 13-08-2025
String toSeverDate() {
String get toServerDate {
return DateFormat('dd-MM-yyyy', 'id_ID').format(this);
}
/// Format jam: 14:30
String toHourMinute() {
String get toHourMinute {
return DateFormat('HH:mm', 'id_ID').format(this);
}
}