Skip to content

Commit

Permalink
First working version
Browse files Browse the repository at this point in the history
  • Loading branch information
MBoretto committed Oct 5, 2023
1 parent e8f848b commit ac29821
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 19 deletions.
19 changes: 17 additions & 2 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,7 @@
</template>

<script>
// eslint-disable-next-line no-unused-vars
import { formattedDate, prepareUrl, prepareCoordinate } from './helpers'
import { prepareUrl, prepareCoordinate } from './helpers'
import UrlCard from "./components/UrlCard.vue";
import GeoCard from "./components/GeoCard.vue";
import TextCard from "./components/TextCard.vue";
Expand Down Expand Up @@ -400,6 +399,22 @@ export default {
// light medium heavy rigid soft
this.TWA.HapticFeedback.impactOccurred("rigid");
this.TWA.HapticFeedback.impactOccurred("heavy");
},
formattedDate(timestamp) {
// Create a Date object from the timestamp
const date = new Date(parseInt(timestamp));
// Extract day, month, year, hour, and minute components
const day = date.getDate();
const month = date.getMonth() + 1; // Months are zero-based, so add 1
const year = date.getFullYear();
const hour = date.getHours();
const minute = date.getMinutes();
const second = date.getSeconds();
// Format the date as "dd/mm/yyyy hh:mm:ss"
const formattedDate = `${day.toString().padStart(2, '0')}/${month.toString().padStart(2, '0')}/${year} ${hour.toString().padStart(2, '0')}:${minute.toString().padStart(2, '0')}:${second.toString().padStart(2, '0')}`;
return formattedDate;
}
}
}
Expand Down
17 changes: 0 additions & 17 deletions src/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,3 @@ export function prepareCoordinate(data) {
const parts = code.split(',');
return {lat: parts[0], lng: parts[1]};
}

export function formattedDate(timestamp) {
// Create a Date object from the timestamp
const date = new Date(parseInt(timestamp));

// Extract day, month, year, hour, and minute components
const day = date.getDate();
const month = date.getMonth() + 1; // Months are zero-based, so add 1
const year = date.getFullYear();
const hour = date.getHours();
const minute = date.getMinutes();
const second = date.getSeconds();
// Format the date as "dd/mm/yyyy hh:mm:ss"
const formattedDate = `${day.toString().padStart(2, '0')}/${month.toString().padStart(2, '0')}/${year} ${hour.toString().padStart(2, '0')}:${minute.toString().padStart(2, '0')}:${second.toString().padStart(2, '0')}`;

return formattedDate;
}

0 comments on commit ac29821

Please sign in to comment.