thai_buddhist_date 0.3.0 copy "thai_buddhist_date: ^0.3.0" to clipboard
thai_buddhist_date: ^0.3.0 copied to clipboard

A small Dart package for parsing and formatting Thai Buddhist (พ.ศ.) dates.

Changelog #

0.3.0 - 2026-05-22 #

Clean Architecture & Production-grade Refactoring #

Bug fixes (may affect existing code)

  • int.toCE now returns the correct CE year.
    Previously 2568.toCE returned 2568 (no-op bug). Now it correctly returns 2025.
    If you added a manual - 543 workaround because you knew it was broken, remove that workaround.

  • Locale constants use underscore format (th_TH, en_US) consistent with the intl package.
    The old hyphen values (th-TH, en-US) were silently rejected by SupportedLocales.isSupported(), so locale initialization never worked when using these constants.
    If you hardcoded 'th-TH' in a string comparison, change it to 'th_TH'.

New features

  • ThaiDate.safe({...}) factory — validates all fields and throws ArgumentError in both debug and release builds. The main ThaiDate({...}) constructor remains const (backward compatible).
  • ThaiDate now implements Comparable<ThaiDate> — supports list.sort() and direct compareTo comparisons.

Internal improvements (no API change)

  • CacheService hit-rate tracking is now real (was always 0.0).
  • CacheService LRU uses LinkedHashSet instead of Map<String,String> (less memory waste).
  • ThaiDateService moved to the Application layer with proper dependency injection.
  • IDateFormatterRepository and IDateParserRepository split into separate files (SRP).
  • Infrastructure repositories use instance-level state (was static — broke test isolation).
  • Parser _normaliseToCE extracted as a shared helper (removed ~15 lines of duplication).
  • Stale .backup file removed from lib/.
  • performance_comparison.dart and test_clean_architecture.dart moved to tool/.
  • Smoke test replaced with 6 meaningful tests.

0.2.7 - 2025-09-15 #

  • Docs: Add screenshots and video demo to README.
  • Version bump to 0.2.7.

0.2.6 Version bump #

  • Bump package version to 0.2.6.
  • Minor packaging fixes and example pubspec indentation.

0.2.5 Formatting only #

  • Run dart format across all Dart sources to satisfy pub score formatting checks.

0.2.4 Docs-only polish for publication #

  • README: clarify sync top-level helpers, locale initialization, and legacy shims.
  • No code changes.

0.2.3 Docs: sync top-level helpers, locale init guidance, compatibility #

  • README overhaul: top-level format/formatNow examples are synchronous; removed unnecessary await.
  • Added "Backward compatibility and sync vs async" section and clarified ThaiDateService.initializeLocale('th_TH') usage.
  • Cleaned Thai section examples to be consistent with current API.

0.2.2 Thai full date preset, custom parts, explicit-era parsing, docs #

  • Add preset pattern 'dmy' for Thai full date output (e.g., 25 สิงหาคม 2568) with BE/CE.
  • Add ThaiCalendar.formatThaiDateParts(...) to build custom strings by reordering/omitting day/month/year; supports short month names and custom separators.
  • Add ThaiCalendar.parseWithEra(...) to parse inputs with an explicit era hint (treat input as BE or CE explicitly).
  • Expand README with detailed Thai usage guide, multi-language examples, and recipes.
  • General docs polish and Markdown fence fixes.

0.2.1 Multi-language API and docs #

  • Add ThaiDateSettings.useLocale(String) for setting any locale code globally.
  • Add TbdLocales class with constants for common language/region codes (e.g., 'fr', 'ar', 'ja', 'zh', etc.).
  • Update documentation: professional multi-language date/time/date&time usage, clear examples for all major languages.

0.2.0 API polish and ergonomics #

  • Clear separation between core date utilities and UI pickers (moved to thai_buddhist_date_pickers).
  • Added ThaiLanguage (thai/english) convenience and locale-aware ensureInitialized.
  • Introduced ThaiDateSettings for global defaults (default era/locale) and helpers to switch Thai/English.
  • Added ThaiFormatter reusable formatter class.
  • Added DateTime.toThaiString() and String.toThaiDate() extensions.
  • Kept all existing APIs for backward compatibility.

0.1.4 Docs cleanup and examples update #

  • Remove Bottom Sheet pickers from package features and examples to align with current scope.
  • Update demo and package READMEs accordingly.
  • No API or behavior changes in the core library.

0.1.2 Lint/format cleanup #

  • Fix while-block lint and ensure package is dart formatted.
  • No behavior changes.

0.1.3 Metadata fix #

  • Update repository URL to non-.git form and fix repo verification by renaming root app. No code changes.

0.1.1 Dependency update #

  • Widen intl constraint to support latest stable releases (up to <0.21.0). No code changes.

0.1.0 Initial #

  • Initial implementation: parse/format Thai Buddhist (พ.ศ.) dates
  • Token-aware formatting, parse BE/CE automatically
  • Helpers: formatSync, formatInitialized, formatWith/parseWith
  • Unit tests
2
likes
160
points
207
downloads

Documentation

API reference

Publisher

verified publisherkidpech.app

Weekly Downloads

A small Dart package for parsing and formatting Thai Buddhist (พ.ศ.) dates.

Repository (GitHub)
View/report issues

Topics

#thai #buddhist #be #date

License

MIT (license)

Dependencies

intl

More

Packages that depend on thai_buddhist_date