Skip to content
This repository was archived by the owner on Jul 28, 2025. It is now read-only.

Commit ac271c0

Browse files
committed
mobile improvement for datepcikers
1 parent 7c2fd49 commit ac271c0

File tree

3 files changed

+34
-3
lines changed

3 files changed

+34
-3
lines changed

docs/docs/changelog.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
1+
## 2.8.2
2+
### Visual
3+
- UX improvements for date picker and time picker
4+
- Checkbox design improvements [randomsnowflake](https://github.com/randomsnowflake)
5+
### No longer broken
6+
- Tags are now properly saved when it's a number with decimals with zero at the end (e.g. 1.0, 1.00, 1.000, etc.)
7+
- Datepicker clear button now works properly [ISSUE#564](https://github.com/RafaelGB/obsidian-db-folder/issues/564)
8+
- Vertical scroll on mobile improved [ISSUE#488](https://github.com/RafaelGB/obsidian-db-folder/issues/488)
29
## 2.8.1
310
### Shiny new things
411
- New rollup functions: Count unique values,Truthy count, Falsy count, Percent empty, Percent filled, Task TODO, Task completed

src/components/cellTypes/CalendarCell.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
import React, { useState } from "react";
1+
import React, {
2+
DetailedHTMLProps,
3+
forwardRef,
4+
InputHTMLAttributes,
5+
useState,
6+
} from "react";
27
import { DateTime } from "luxon";
38
import DatePicker from "react-datepicker";
49
import { Portal } from "@mui/material";
@@ -7,6 +12,7 @@ import { CellComponentProps } from "cdm/ComponentsModel";
712
import { TableColumn } from "cdm/FolderModel";
813
import { ParseService } from "services/ParseService";
914
import { InputType } from "helpers/Constants";
15+
import { Platform } from "obsidian";
1016

1117
const CalendarCell = (calendarProps: CellComponentProps) => {
1218
const { defaultCell } = calendarProps;
@@ -66,6 +72,11 @@ const CalendarCell = (calendarProps: CellComponentProps) => {
6672
}, 100);
6773
};
6874

75+
const ReactDatePickerInput = forwardRef<
76+
HTMLInputElement,
77+
DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>
78+
>((props, ref) => <input ref={ref} {...props} readOnly />);
79+
6980
return showDatePicker ? (
7081
<DatePicker
7182
dateFormat={configInfo.getLocalSettings().date_format}
@@ -78,6 +89,7 @@ const CalendarCell = (calendarProps: CellComponentProps) => {
7889
popperContainer={CalendarContainer}
7990
onClickOutside={closeEditCalendarCell}
8091
onCalendarClose={closeEditCalendarCell}
92+
customInput={Platform.isMobile ? <ReactDatePickerInput /> : null}
8193
autoFocus
8294
isClearable
8395
ariaLabelClose="Clear"

src/components/cellTypes/CalendarTimeCell.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
import React, { useState } from "react";
1+
import React, {
2+
DetailedHTMLProps,
3+
forwardRef,
4+
InputHTMLAttributes,
5+
useState,
6+
} from "react";
27
import { DateTime } from "luxon";
38
import DatePicker from "react-datepicker";
49
import { Portal } from "@mui/material";
@@ -7,6 +12,7 @@ import { TableColumn } from "cdm/FolderModel";
712
import { ParseService } from "services/ParseService";
813
import { InputType } from "helpers/Constants";
914
import { c } from "helpers/StylesHelper";
15+
import { Platform } from "obsidian";
1016

1117
const CalendarTimeCell = (calendarTimeProps: CellComponentProps) => {
1218
const { defaultCell } = calendarTimeProps;
@@ -67,6 +73,11 @@ const CalendarTimeCell = (calendarTimeProps: CellComponentProps) => {
6773
}, 100);
6874
};
6975

76+
const ReactDatePickerInput = forwardRef<
77+
HTMLInputElement,
78+
DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>
79+
>((props, ref) => <input ref={ref} {...props} readOnly />);
80+
7081
return showDatePicker &&
7182
(tableColumn.isMetadata === undefined || !tableColumn.isMetadata) ? (
7283
<DatePicker
@@ -80,6 +91,7 @@ const CalendarTimeCell = (calendarTimeProps: CellComponentProps) => {
8091
popperContainer={CalendarContainer}
8192
onClickOutside={closeEditCalendarTimeCell}
8293
onCalendarClose={closeEditCalendarTimeCell}
94+
customInput={Platform.isMobile ? <ReactDatePickerInput /> : null}
8395
timeFormat="HH:mm"
8496
timeCaption="time"
8597
showTimeSelect

0 commit comments

Comments
 (0)