Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 1.2.1
* Fixed incorrect timezone handling when [DateTime](https://api.flutter.dev/flutter/dart-core/DateTime-class.html) where UTC-based times were being misinterpreted as local time during formatting and parsing.

## 1.2.0
* Added `isILibReady` getter to `ILibJS` class to expose internal `_iLibPrepared` state.
* Added `isILibReady` getter to `FlutterILib` class for external access to ILibJS initialization status.
Expand Down
4 changes: 3 additions & 1 deletion lib/ilib_datefmt.dart
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,9 @@ class ILibDateOptions {

final Map<String, String> paramInfo = <String, String>{
'locale': '$locale',
'timezone': '$timezone',
// If dateTime is not null and is in UTC, set timezone to 'Etc/UTC'.
// Otherwise, use the provided timezone value.
'timezone': (dateTime?.isUtc ?? false) ? 'Etc/UTC' : '$timezone',
'type': '$type',
'calendar': '$calendar'
};
Expand Down
8 changes: 8 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "4.0.0"
logging:
dependency: "direct main"
description:
name: logging
sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61
url: "https://pub.dev"
source: hosted
version: "1.3.0"
matcher:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_ilib
description: "A wrapper plugin to conveniently use 'iLib' in Flutter app for internationalization. This plugin uses the 'flutter_js' to make the JavaScript file work properly in the Flutter app."
version: 1.2.0
version: 1.2.1
homepage: https://github.com/iLib-js/flutter_ilib
repository: https://github.com/iLib-js/flutter_ilib

Expand Down
16 changes: 16 additions & 0 deletions test/basic/flutter_ilib_datefmt_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,22 @@ void main() {
ILibDateOptions(dateTime: DateTime.parse('2024-06-27 10:42'));
expect(fmt.format(dateOptions), '2024년 6월 27일 오전 10:42');
});
test('ILibDateFmt_DateTimeObj_utc_koKR', () {
final ILibDateFmtOptions fmtOptions = ILibDateFmtOptions(
locale: 'ko-KR', length: 'full', type: 'datetime', useNative: false);
final ILibDateFmt fmt = ILibDateFmt(fmtOptions);
final ILibDateOptions dateOptions =
ILibDateOptions(dateTime: DateTime.parse('2024-06-27 10:42Z'));
expect(fmt.format(dateOptions), '2024년 6월 27일 오후 7:42');
});
test('ILibDateFmt_DateTimeObj_utc_enUS', () {
final ILibDateFmtOptions fmtOptions = ILibDateFmtOptions(
locale: 'en-US', length: 'full', type: 'datetime', useNative: false);
final ILibDateFmt fmt = ILibDateFmt(fmtOptions);
final ILibDateOptions dateOptions =
ILibDateOptions(dateTime: DateTime.utc(2024, 6, 27, 10, 42));
expect(fmt.format(dateOptions), 'June 27, 2024 at 6:42 AM');
});
});
group('getClock()', () {
test('getClock_ko_KR', () {
Expand Down