mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-10 17:21:38 -05:00
Let maps consider the timezone of the application
This commit is contained in:
parent
d52b538398
commit
036b21b5a5
2 changed files with 4 additions and 9 deletions
|
|
@ -96,15 +96,9 @@ export default class extends Controller {
|
|||
formatDate(timestamp) {
|
||||
let date = new Date(timestamp * 1000); // Multiply by 1000 because JavaScript works with milliseconds
|
||||
|
||||
// Extracting date components
|
||||
let year = date.getFullYear();
|
||||
let month = ('0' + (date.getMonth() + 1)).slice(-2); // Adding 1 because getMonth() returns zero-based month
|
||||
let day = ('0' + date.getDate()).slice(-2);
|
||||
let hours = ('0' + date.getHours()).slice(-2);
|
||||
let minutes = ('0' + date.getMinutes()).slice(-2);
|
||||
let seconds = ('0' + date.getSeconds()).slice(-2);
|
||||
let timezone = this.element.dataset.timezone;
|
||||
|
||||
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
||||
return date.toLocaleString('en-GB', { timeZone: timezone });
|
||||
}
|
||||
|
||||
addTileLayer(map) {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,8 @@
|
|||
class="w-full"
|
||||
data-controller="maps"
|
||||
data-coordinates="<%= @coordinates %>"
|
||||
data-center="<%= MAP_CENTER %>">
|
||||
data-center="<%= MAP_CENTER %>"
|
||||
data-timezone="<%= Rails.configuration.time_zone %>">
|
||||
<div data-maps-target="container" class="h-[25rem] w-auto min-h-screen"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in a new issue