Revert "Add setting for date format"

This reverts commit 023041b846.
This commit is contained in:
Brandon Presley 2022-09-26 19:13:48 +13:00
parent e1b7e80e2f
commit 3691c729b4
4 changed files with 2 additions and 35 deletions

View File

@ -27,7 +27,6 @@ export default function SettingsPage() {
const [showUnit, setShowUnit] = useState(!!settings.showUnit);
const [workouts, setWorkouts] = useState(!!settings.workouts);
const [steps, setSteps] = useState(!!settings.steps);
const [date, setDate] = useState('%Y-%m-%d %H:%M');
const {color, setColor} = useContext(CustomTheme);
const {toast} = useContext(SnackbarContext);
@ -49,7 +48,6 @@ export default function SettingsPage() {
color,
workouts: +workouts,
steps: +steps,
date,
});
getSettings();
}, [
@ -63,7 +61,6 @@ export default function SettingsPage() {
color,
workouts,
steps,
date,
]);
const changeAlarmEnabled = useCallback(
@ -192,23 +189,6 @@ export default function SettingsPage() {
))}
</Picker>
)}
{'date format'.includes(search.toLowerCase()) && (
<Picker
style={{color}}
dropdownIconColor={color}
selectedValue={date}
onValueChange={value => setDate(value)}>
<Picker.Item
value="%Y-%m-%d %H:%M"
label="Format date as 1990-12-24 15:05"
/>
<Picker.Item
value="%Y-%m-%d"
label="Format date as 1990-12-24 (YYYY-MM-dd)"
/>
<Picker.Item value="%m-%d" label="Format date as 12-24 (MM-dd)" />
</Picker>
)}
{'alarm sound'.includes(search.toLowerCase()) && (
<Button style={{alignSelf: 'flex-start'}} onPress={changeSound}>
Alarm sound

3
db.ts
View File

@ -103,9 +103,6 @@ const migrations = [
`
ALTER TABLE settings ADD COLUMN nextAlarm TEXT NULL
`,
`
ALTER TABLE settings ADD COLUMN date TEXT NULL
`,
];
export let db: SQLiteDatabase;

View File

@ -1,6 +1,5 @@
import {db} from './db';
import Set from './set';
import {settings} from './settings.service';
export const updateSet = async (value: Set) => {
const update = `
@ -66,21 +65,13 @@ export const getSets = async ({
limit,
offset,
}: PageParams): Promise<Set[]> => {
const format = settings.date || '%Y-%m-%d %H:%M';
const select = `
SELECT id, name, reps, weight, sets, minutes, seconds,
STRFTIME(?, created) as created, unit, image, steps
FROM sets
SELECT * from sets
WHERE name LIKE ? AND NOT hidden
ORDER BY created DESC
LIMIT ? OFFSET ?
`;
const [result] = await db.executeSql(select, [
format,
`%${search}%`,
limit,
offset,
]);
const [result] = await db.executeSql(select, [`%${search}%`, limit, offset]);
return result.rows.raw();
};

View File

@ -10,5 +10,4 @@ export default interface Settings {
workouts: number;
steps: number;
nextAlarm?: string;
date?: string;
}