format_indonesia 0.1.0

Dart native js
Flutter Android iOS web

Library for Indonesian formatting

Indonesian Formatter for Dart #

This is a library for Indonesian formatting, provides DateTime and number formatting.

Waktu class #

Translate to Indonesian for weekday names, month names, and quarter names, inspired by DateFormat.

Example #

import 'package:format_indonesia/format_indonesia.dart';

void main() {
  // using current time
  var waktu = Waktu();
  print(waktu.yMMMMEEEEd()); // Jumat, 19 Juni 2020 (this was the current time when development)

  // using specific time
  DateTime datetime = DateTime.parse('2020-05-31 12:34:13');
  print(Waktu(datetime).yMMMMEEEEd()); // Minggu, 31 Mei 2020
}

Supported formatters #

Formatter                       Result
---------                       ------
Waktu().E()                     Jum
Waktu().EEEE()                  Jumat
Waktu().LLL()                   Jun
Waktu().LLLL()                  Juni
Waktu().MMM()                   Jun
Waktu().MMMd()                  19 Jun
Waktu().MMMEd()                 Jum, 19 Jun
Waktu().MMMM()                  Juni
Waktu().MMMMd()                 19 Juni
Waktu().MMMMEEEEd()             Jumat, 19 Juni
Waktu().QQQQ()                  Kuartal kedua
Waktu().yMd()                   19/6/2020
Waktu().yMEd()                  Jum, 19/6/2020
Waktu().yMMM()                  Jun 2020
Waktu().yMMMd()                 19 Jun 2020
Waktu().yMMMEd()                Jum, 19 Jun 2020
Waktu().yMMMM()                 Juni 2020
Waktu().yMMMMd()                19 Juni 2020
Waktu().yMMMMEEEEd()            Jumat, 19 Juni 2020

Pattern formatter #

import 'package:format_indonesia/format_indonesia.dart';

void main() {
  // using current time
  var waktu = Waktu();
  print(waktu.format('dd MMM yyyy')); // 19 Jun 2020 (this was the current time when development)

  // using specific time
  DateTime datetime = DateTime.parse('2020-05-31 12:34:13');
  print(Waktu(datetime).format('EEEE, d MMMM y')); // Minggu, 31 Mei 2020
}

Supported patterns is referenced to DateFormat.

Numerik class #

In this version, provides number to text convertion.

Example #

import 'package:format_indonesia/format_indonesia.dart';

void main() {
  var numerik = Numerik(911);
  print(numerik.terbilang()); // sembilan ratus sebelas
}

Thank you. #

It is really helpful if there are ideas, suggestions, or input for next improvement.