Use strftime in sqlite instead of new date
The javascript date method was messing up the timezones.
This commit is contained in:
parent
a85d5464be
commit
6eacddf2d0
|
@ -52,12 +52,12 @@ export default function EditSet() {
|
|||
|
||||
const add = useCallback(
|
||||
async (set: Set) => {
|
||||
const {name, reps, weight, created, unit} = set;
|
||||
const {name, reps, weight, unit} = set;
|
||||
const insert = `
|
||||
INSERT INTO sets(name, reps, weight, created, unit)
|
||||
VALUES (?,?,?,?,?)
|
||||
VALUES (?,?,?,strftime('%Y-%m-%dT%H:%M:%S', 'now', 'localtime'),?)
|
||||
`;
|
||||
await db.executeSql(insert, [name, reps, weight, created, unit]);
|
||||
await db.executeSql(insert, [name, reps, weight, unit]);
|
||||
notify();
|
||||
navigation.goBack();
|
||||
},
|
||||
|
|
|
@ -92,7 +92,6 @@ export default function SetList() {
|
|||
weight: 0,
|
||||
name: '',
|
||||
reps: 0,
|
||||
created: new Date().toISOString(),
|
||||
id: 0,
|
||||
};
|
||||
const [repsResult] = await db.executeSql(bestReps, [
|
||||
|
@ -167,12 +166,12 @@ export default function SetList() {
|
|||
|
||||
const onAdd = useCallback(async () => {
|
||||
const set: Set = {
|
||||
created: new Date().toISOString(),
|
||||
name: '',
|
||||
id: 0,
|
||||
reps: 0,
|
||||
weight: 0,
|
||||
unit: 'kg',
|
||||
created: new Date().toISOString(),
|
||||
};
|
||||
navigation.navigate('EditSet', {set: nextSet || set});
|
||||
}, [navigation, nextSet]);
|
||||
|
|
Loading…
Reference in New Issue
Block a user