getDateTime function
Implementation
String getDateTime({
required String date,
String? format,
bool toApi = true,
bool isUTC = true,
String locale = 'en_US',
}) {
try {
return DateFormat(
format ?? DateFormats.dateTime.format,
toApi ? 'en_US' : locale,
).format(
isUTC
? DateTime.tryParse(date)?.toLocal() ?? DateTime.now()
: DateTime.tryParse(date) ?? DateTime.now(),
);
} catch (e) {
log(e.toString());
return "";
}
}