mirror of
https://framagit.org/tom79/fediplan.git
synced 2025-04-05 05:31:48 +02:00
Display date with browser timezone
This commit is contained in:
parent
618da03e0e
commit
4ffe74a73a
2 changed files with 9 additions and 6 deletions
|
@ -396,6 +396,7 @@
|
||||||
<script src="{{ asset('js/moment.js') }}"></script>
|
<script src="{{ asset('js/moment.js') }}"></script>
|
||||||
<script src="{{ asset('js/emojionearea.js') }}"></script>
|
<script src="{{ asset('js/emojionearea.js') }}"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -545,14 +546,16 @@
|
||||||
searchPosition: "bottom",
|
searchPosition: "bottom",
|
||||||
search: false
|
search: false
|
||||||
});
|
});
|
||||||
var timezone;
|
let userTimezone;
|
||||||
|
|
||||||
if(!!sessionStorage.getItem('timeZone')) {
|
if(!!sessionStorage.getItem('timeZone')) {
|
||||||
timezone = sessionStorage.getItem('timeZone');
|
userTimezone = sessionStorage.getItem('timeZone');
|
||||||
} else {
|
} else {
|
||||||
timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
userTimezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
||||||
}
|
}
|
||||||
$('#compose_timeZone').val(timezone);
|
|
||||||
|
|
||||||
|
$("#compose_scheduled_at").val(new Date(new Date().toString().split('GMT')[0]+' UTC').toISOString().split('.')[0]);
|
||||||
|
$('#compose_timeZone').val(userTimezone);
|
||||||
$('#compose_timeZone').on('change', function () {
|
$('#compose_timeZone').on('change', function () {
|
||||||
sessionStorage.setItem("timeZone", this.value);
|
sessionStorage.setItem("timeZone", this.value);
|
||||||
});
|
});
|
||||||
|
|
|
@ -58,7 +58,7 @@
|
||||||
lang = navigator.language.slice(0,2);
|
lang = navigator.language.slice(0,2);
|
||||||
}
|
}
|
||||||
function convertTZ(date) {
|
function convertTZ(date) {
|
||||||
return new Intl.DateTimeFormat(lang, { dateStyle: "full" , timeStyle: "long", timeZone: userTimezone}).format(new Date(date)).toLocaleString();
|
return new Intl.DateTimeFormat(lang, { dateStyle: "full" , timeStyle: "long", timeZone: userTimezone}).format(new Date(date + " UTC")).toLocaleString();
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue