formatDateNepali function
Implementation
String formatDateNepali(String inputDate) {
// Parse input date string
List<String> parts = inputDate.split('-');
if (parts.length != 3) {
throw const FormatException("Invalid date format. Expected yyyy-m-d");
}
// Extract year, month, and day
String year = parts[0];
String month = parts[1].padLeft(2, '0');
String day = parts[2].padLeft(2, '0');
// Format to yyyy-mm-dd
String formattedDate = '$year-$month-$day';
return formattedDate;
}