Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

chore: add loose restrictions to date time text field (#7024)

Mathias Mogensened646ccba2b4
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/date_picker/widgets/date_time_text_field.dart b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/date_picker/widgets/date_time_text_field.dart
index acd50ce764..553ffb4c0d 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/date_picker/widgets/date_time_text_field.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/date_picker/widgets/date_time_text_field.dart
@@ -301,6 +301,14 @@ class _DateTimeTextFieldState extends State<DateTimeTextField> {
focusNode: timeFocusNode,
controller: timeTextController,
style: Theme.of(context).textTheme.bodyMedium,
+ maxLength: widget.timeFormat == TimeFormatPB.TwelveHour
+ ? 8 // 12:34 PM = 8 characters
+ : 5, // 12:34 = 5 characters
+ inputFormatters: [
+ FilteringTextInputFormatter.allow(
+ RegExp('[0-9:AaPpMm]'),
+ ),
+ ],
decoration: getInputDecoration(
const EdgeInsetsDirectional.fromSTEB(6, 6, 12, 6),
timeFormat.format(hintDate),
@@ -359,6 +367,7 @@ class _DateTimeTextFieldState extends State<DateTimeTextField> {
isCollapsed: true,
isDense: true,
hintText: widget.showHint ? hintText : null,
+ counterText: "",
hintStyle: Theme.of(context)
.textTheme
.bodyMedium