Skip to content

Commit a5e0e97

Browse files
Merge pull request #1080 from richardshiue/fix-include-time
fix: some improvements for when including time in a date cell
2 parents 4e0b9c8 + 05975e5 commit a5e0e97

File tree

11 files changed

+24
-21
lines changed

11 files changed

+24
-21
lines changed

frontend/app_flowy/assets/translations/en.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,8 @@
222222
"document": {
223223
"menuName": "Doc",
224224
"date": {
225-
"timeHintTextInTwelveHour": "12:00 AM",
226-
"timeHintTextInTwentyFourHour": "12:00"
225+
"timeHintTextInTwelveHour": "01:00 PM",
226+
"timeHintTextInTwentyFourHour": "13:00"
227227
}
228228
},
229229
"board": {

frontend/app_flowy/assets/translations/es-VE.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,8 @@
210210
"document": {
211211
"menuName": "Doc",
212212
"date": {
213-
"timeHintTextInTwelveHour": "12:00 AM",
214-
"timeHintTextInTwentyFourHour": "12:00"
213+
"timeHintTextInTwelveHour": "01:00 PM",
214+
"timeHintTextInTwentyFourHour": "13:00"
215215
}
216216
},
217217
"sideBar": {

frontend/app_flowy/assets/translations/fr-FR.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,8 @@
208208
"document": {
209209
"menuName": "Doc",
210210
"date": {
211-
"timeHintTextInTwelveHour": "12:00 AM",
212-
"timeHintTextInTwentyFourHour": "12:00"
211+
"timeHintTextInTwelveHour": "01:00 PM",
212+
"timeHintTextInTwentyFourHour": "13:00"
213213
}
214214
}
215215
}

frontend/app_flowy/assets/translations/id-ID.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,8 @@
211211
"document": {
212212
"menuName": "Doc",
213213
"date": {
214-
"timeHintTextInTwelveHour": "12:00 AM",
215-
"timeHintTextInTwentyFourHour": "12:00"
214+
"timeHintTextInTwelveHour": "01:00 PM",
215+
"timeHintTextInTwentyFourHour": "13:00"
216216
}
217217
},
218218
"sideBar": {

frontend/app_flowy/assets/translations/ru-RU.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,8 @@
221221
"document": {
222222
"menuName": "Документ",
223223
"date": {
224-
"timeHintTextInTwelveHour": "12:00 AM",
225-
"timeHintTextInTwentyFourHour": "12:00"
224+
"timeHintTextInTwelveHour": "01:00 PM",
225+
"timeHintTextInTwentyFourHour": "13:00"
226226
}
227227
},
228228
"board": {

frontend/app_flowy/assets/translations/zh-CN.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,8 @@
215215
"document": {
216216
"menuName": "文档",
217217
"date": {
218-
"timeHintTextInTwelveHour": "12:00 AM",
219-
"timeHintTextInTwentyFourHour": "12:00"
218+
"timeHintTextInTwelveHour": "01:00 PM",
219+
"timeHintTextInTwentyFourHour": "13:00"
220220
}
221221
}
222222
}

frontend/app_flowy/assets/translations/zh-TW.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,8 @@
211211
"document": {
212212
"menuName": "檔案",
213213
"date": {
214-
"timeHintTextInTwelveHour": "12:00 AM",
215-
"timeHintTextInTwentyFourHour": "12:00"
214+
"timeHintTextInTwelveHour": "01:00 PM",
215+
"timeHintTextInTwentyFourHour": "13:00"
216216
}
217217
},
218218
"sideBar": {

frontend/app_flowy/lib/plugins/grid/application/cell/date_cal_bloc.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ class DateCalBloc extends Bloc<DateCalEvent, DateCalState> {
108108
(err) {
109109
switch (ErrorCode.valueOf(err.code)!) {
110110
case ErrorCode.InvalidDateTimeFormat:
111-
updateCalData(none(), Some(timeFormatPrompt(err)));
111+
updateCalData(state.calData, Some(timeFormatPrompt(err)));
112112
break;
113113
default:
114114
Log.error(err);
@@ -119,13 +119,13 @@ class DateCalBloc extends Bloc<DateCalEvent, DateCalState> {
119119
}
120120

121121
String timeFormatPrompt(FlowyError error) {
122-
String msg = "${LocaleKeys.grid_field_invalidTimeFormat.tr()}. ";
122+
String msg = "${LocaleKeys.grid_field_invalidTimeFormat.tr()}.";
123123
switch (state.dateTypeOptionPB.timeFormat) {
124124
case TimeFormat.TwelveHour:
125-
msg = "${msg}e.g. 01: 00 AM";
125+
msg = "$msg e.g. 01:00 PM";
126126
break;
127127
case TimeFormat.TwentyFourHour:
128-
msg = "${msg}e.g. 13: 00";
128+
msg = "$msg e.g. 13:00";
129129
break;
130130
default:
131131
break;

frontend/app_flowy/lib/plugins/grid/presentation/widgets/cell/date_cell/date_editor.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ class _TimeTextFieldState extends State<_TimeTextField> {
261261
child: RoundedInputField(
262262
height: 40,
263263
focusNode: _focusNode,
264+
autoFocus: true,
264265
hintText: state.timeHintText,
265266
controller: _controller,
266267
style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w500),

frontend/rust-lib/flowy-grid/src/services/field/type_options/date_type_option/date_tests.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,9 @@ mod tests {
141141
.unwrap();
142142

143143
if type_option.include_time {
144-
format!("{}{}", decoded_data.date, decoded_data.time)
144+
format!("{} {}", decoded_data.date, decoded_data.time)
145+
.trim_end()
146+
.to_owned()
145147
} else {
146148
decoded_data.date
147149
}

0 commit comments

Comments
 (0)