diff --git a/composer.json b/composer.json index 7218a81..4b27bde 100644 --- a/composer.json +++ b/composer.json @@ -40,7 +40,8 @@ "symfony/validator": "7.0.*", "symfony/web-link": "7.0.*", "symfony/yaml": "7.0.*", - "twig/extra-bundle": "^2.12|^3.0", + "twig/extra-bundle": "^3.20", + "twig/intl-extra": "^3.20", "twig/twig": "v3.15.0" }, "config": { diff --git a/composer.lock b/composer.lock index 193bb10..ac7ce63 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "088c0941ec8a7b29575fdbaf090412d3", + "content-hash": "e0f8b9b4d95600fa7505117747bb8660", "packages": [ { "name": "composer/semver", @@ -5887,6 +5887,70 @@ ], "time": "2025-02-08T09:47:15+00:00" }, + { + "name": "twig/intl-extra", + "version": "v3.20.0", + "source": { + "type": "git", + "url": "https://github.com/twigphp/intl-extra.git", + "reference": "05bc5d46b9df9e62399eae53e7c0b0633298b146" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/twigphp/intl-extra/zipball/05bc5d46b9df9e62399eae53e7c0b0633298b146", + "reference": "05bc5d46b9df9e62399eae53e7c0b0633298b146", + "shasum": "" + }, + "require": { + "php": ">=8.1.0", + "symfony/intl": "^5.4|^6.4|^7.0", + "twig/twig": "^3.13|^4.0" + }, + "require-dev": { + "symfony/phpunit-bridge": "^6.4|^7.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Twig\\Extra\\Intl\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" + } + ], + "description": "A Twig extension for Intl", + "homepage": "https://twig.symfony.com", + "keywords": [ + "intl", + "twig" + ], + "support": { + "source": "https://github.com/twigphp/intl-extra/tree/v3.20.0" + }, + "funding": [ + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/twig/twig", + "type": "tidelift" + } + ], + "time": "2025-01-31T20:45:36+00:00" + }, { "name": "twig/twig", "version": "v3.15.0", diff --git a/templates/fediplan/Ajax/layout.html.twig b/templates/fediplan/Ajax/layout.html.twig index 1381468..08201ec 100644 --- a/templates/fediplan/Ajax/layout.html.twig +++ b/templates/fediplan/Ajax/layout.html.twig @@ -46,7 +46,7 @@ {% elseif status.visibility == "direct" %} <i class="fa fa-envelope"></i> {% endif %} - </small> - {{ status.scheduledAt | date('d/m/y H:i') }} + </small> - <span class="date-UTC"> {{ status.scheduledAt | date('Y-m-d H:m:s') }}</span> <button class="btn btn-danger btn-sm" data-record-id="{{ status.getId() }}" style="position: absolute;right: 5px;bottom: 5px;" {% if status.content is not null %} diff --git a/templates/fediplan/scheduled.html.twig b/templates/fediplan/scheduled.html.twig index 563473f..4578d5a 100644 --- a/templates/fediplan/scheduled.html.twig +++ b/templates/fediplan/scheduled.html.twig @@ -32,7 +32,7 @@ <p>{{ 'common.proceed_confirm'|trans }}</p> </div> <div class="modal-footer"> - <button type="button" class="btn btn-secondary" data-dismiss="modal">{{ 'common.cancel'|trans }}</button> + <button type="button" class="btn btn-secondary btn-cancel" data-bs-dismiss="modal">{{ 'common.cancel'|trans }}</button> <button type="button" class="btn btn-danger btn-ok">{{ 'common.delete'|trans }}</button> </div> </div> @@ -45,6 +45,22 @@ <script src="{{ asset('bundles/fosjsrouting/js/router.min.js') }}"></script> <script src="{{ path('fos_js_routing_js', { callback: 'fos.Router.setData' }) }}"></script> <script type="text/javascript"> + let userTimezone; + let lang; + if(!!sessionStorage.getItem('timeZone')) { + userTimezone = sessionStorage.getItem('timeZone'); + } else { + userTimezone = Intl.DateTimeFormat().resolvedOptions().timeZone; + } + if (navigator.languages !== undefined) { + lang = navigator.languages[0].slice(0,2); + } else { + lang = navigator.language.slice(0,2); + } + function convertTZ(date) { + return new Intl.DateTimeFormat(lang, { dateStyle: "full" , timeStyle: "long", timeZone: userTimezone}).format(new Date(date)).toLocaleString(); + } + $(document).ready(function() { window.max_id = ""; $(window).scroll(function() { @@ -62,6 +78,11 @@ $.get( Routing.generate('load_more', { 'max_id': window.max_id } )) .done(function(data) { $("#content").append(data.html); + $(".date-UTC").each(function (index){ + $( this ).removeClass("date-UTC").addClass("date-converted"); + const dateStr = $(this).text(); + $(this).text(convertTZ(dateStr)); + }); $('#loader').addClass("d-none"); if( typeof data.html != "undefined" && data.html !== "") { // $("#no_content").addClass("d-none");