aissat / easy_localization

Easy and Fast internationalizing your Flutter Apps
https://pub.dev/packages/easy_localization
MIT License
908 stars 325 forks source link

How to change default "DateFormat('d').format" format #652

Closed Kurogoma939 closed 7 months ago

Kurogoma939 commented 7 months ago

When use this package and device language setting is Japanese. I wrote this code.

final today = DateTime.now();
DateFormat('d').format(today)
// result is "26日"

so I want to remove "日"

Kurogoma939 commented 7 months ago

I found the root cause. The intl package affect this problem.

Intl.defaultFormat = 'ja_JP';
final date = DateTime('2024-2-29');
print(DateFormat('d').format(date); // 29日
Intl.defaultFormat = 'en_US';
final date = DateTime('2024-2-29');
print(DateFormat('d').format(date); // 29