defaultDateTimeFormatter function

String defaultDateTimeFormatter(
  1. FormeDateTimeType type,
  2. DateTime dateTime
)

Implementation

String defaultDateTimeFormatter(FormeDateTimeType type, DateTime dateTime) {
  switch (type) {
    case FormeDateTimeType.date:
      return '${dateTime.year.toString()}-${dateTime.month.toString().padLeft(2, '0')}-${dateTime.day.toString().padLeft(2, '0')}';
    case FormeDateTimeType.dateTime:
      return '${dateTime.year.toString()}-${dateTime.month.toString().padLeft(2, '0')}-${dateTime.day.toString().padLeft(2, '0')} ${dateTime.hour.toString().padLeft(2, '0')}:${dateTime.minute.toString().padLeft(2, '0')}';
  }
}