Skip to content

Commit

Permalink
Merge pull request #28 from samderlust/27-incorrect-time-is-shown-for…
Browse files Browse the repository at this point in the history
…-1200-pm-when-using-12-hour-time-format

fix 12hour format issue display 00:00PM
  • Loading branch information
samderlust authored Oct 15, 2024
2 parents 0d57417 + b2df0b8 commit 8d66dc5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/src/extensions/date_time_extension.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ extension DateTimeExtension on DateTime {
String get hourDisplay24 =>
"${hour.toString().padLeft(2, '0')}:${minute.toString().padLeft(2, "0")}";
String get hourDisplay12 =>
"${(hour % 12).toString().padLeft(2, '0')}:${minute.toString().padLeft(2, '0')} ${hour >= 12 ? 'PM' : 'AM'}";
"${(hour % 12 == 0 ? 12 : hour % 12).toString().padLeft(2, '0')}:${minute.toString().padLeft(2, '0')} ${hour >= 12 ? 'PM' : 'AM'}";
}

0 comments on commit 8d66dc5

Please sign in to comment.