Browse Source

Fixing undefined date and converting its value to string

master
GabrielTrettel 4 years ago
parent
commit
836146eae1
  1. 5
      src/app/database/databaseLoader.js
  2. 3
      src/app/screens/PluviometerSharingDataScreen.js

5
src/app/database/databaseLoader.js

@ -1,6 +1,9 @@
import "../config/globals";
import moment from "moment";
function transaction(db, query, values) {
console.log("inserting values");
db.transaction((tx) => {
tx.executeSql(
query,
@ -42,7 +45,7 @@ function insertPluviometerData({ pluviometer, images, dateTime, location }) {
}
const values = [
dateTime,
moment(dateTime).format("DD/MM/YYYY"),
JSON.stringify(images),
parseFloat(location["latitude"]),
parseFloat(location["longitude"]),

3
src/app/screens/PluviometerSharingDataScreen.js

@ -15,6 +15,7 @@ import { showMessage } from "react-native-flash-message";
import { dimensions, scaleDimsFromWidth } from "../config/dimensions";
import FormDatePicker from "../components/forms/FormDatePicker";
import colors from "../config/colors/";
import moment from "moment";
const dims = scaleDimsFromWidth(85, 85, 25);
@ -31,7 +32,7 @@ const validationSchema = Yup.object().shape({
function PluviometerSharingDataScreen(props) {
const location = useLocation();
const [dateTime, setDateTime] = useState();
const [dateTime, setDateTime] = useState(moment());
return (
<Screen style={styles.container}>

Loading…
Cancel
Save