[migration/ilib-js-to-dart] Convert ILibDateFmt, ILibDate, and Calendar systems to pure Dart#63
Open
gouniLee wants to merge 13 commits into
Open
[migration/ilib-js-to-dart] Convert ILibDateFmt, ILibDate, and Calendar systems to pure Dart#63gouniLee wants to merge 13 commits into
gouniLee wants to merge 13 commits into
Conversation
…etc), and timezone
…ing to the type of date
…and persian calendar
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist
The following lists affects Pub Points on pub.dev when the package is published.
dart formatcommand.note. The code for migrating flutter_ilib to Dart will be merged into the migration/ilib-js-to-dart branch, and once all code has been fully converted, it will be merged into the develop branch at once.
Description
Remove JavaScript interop (
flutter_js) fromILibDateFmtandILibDate, replacingwith pure Dart implementations. Implement 9 calendar systems, timezone/DST calculation,
and astronomical computations entirely in Dart using JSON locale data.
Changes
Date Formatting (
lib/ilib_datefmt.dart)ILibDateFmtto readilib.data.dateformatsandilib.data.sysresdirectlysysreslocale dataDate Options (
lib/ilib_date.dart)_toCalendarDate()that delegates to the appropriate calendar date classgetDayOfWeek(),getWeekOfYear(),getEra()via lazy_getCalendarDate()Timezone (
lib/ilib_timezone.dart)ilib.data.zoneinfoJSONCalendar Systems (
lib/calendar/)New implementations for 9 calendars, each with Date + RataDie + Cal classes:
ILibAstrocalculationsAstronomical Calculations (
lib/calendar/ilib_astro.dart)ilib.data.astroJSON coefficientsInfrastructure (
lib/ilib_init.dart)Locale Data
Design Decisions
Date → RD → Julian Day → target calendar RD → Date
use the same calendar, raw year/month/day values are preserved (JS GregorianDate
does not normalize; Dart would — so we skip conversion)
_getCalendarDate()only invoked forcalendar-dependent tokens (day-of-week, week-of-year)
Tests
ILibLoaderEthiopic, Coptic, Persian (8 test files for RataDie, 8 for CalendarDate)
Test Plan
flutter test test/datefmt/— date formatting across 90+ localesflutter test test/calendar/— calendar calculationsflutter test test/timezone/— timezone/DST resolutionflutter analyze— static analysis clean