Skip to content

Commit

Permalink
feat: auto capitalize am-pm in formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
AnsahMohammad committed Feb 29, 2024
1 parent e45b2ef commit 6017df5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ class _MentionDateBlockState extends State<MentionDateBlock> {
DateTime _parseTime(String timeStr, UserTimeFormatPB timeFormat) {
final twelveHourFormat = DateFormat('hh:mm a');
final twentyFourHourFormat = DateFormat('HH:mm');

try {
if (timeFormat == UserTimeFormatPB.TwelveHour) {
return twelveHourFormat.parseStrict(timeStr);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ class TimeInputFormatter extends TextInputFormatter {
return _formatText(newText, spacePosition, ' ');
}

return newValue;
return TextEditingValue(
text: newText.toUpperCase(),
);
}

TextEditingValue _formatText(String text, int index, String separator) {
Expand Down

0 comments on commit 6017df5

Please sign in to comment.