Use format_datetime filters from twig core instead of deprecated twig/extensions

This commit is contained in:
Jan Böhmer 2019-11-23 14:48:21 +01:00
parent 26fe946de3
commit cd5f099965
12 changed files with 19 additions and 100 deletions

View file

@ -45,9 +45,8 @@
"symfony/web-link": "4.4.*",
"symfony/webpack-encore-bundle": "^1.1",
"symfony/yaml": "4.4.*",
"twig/extensions": "^1.5",
"twig/extra-bundle": "3.x-dev",
"twig/intl-extra": "3.x-dev",
"twig/extra-bundle": "^3.0",
"twig/intl-extra": "^3.0",
"webmozart/assert": "^1.4"
},
"require-dev": {

63
composer.lock generated
View file

@ -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": "d5ab5fdad23b0879dba64df3d0c7346a",
"content-hash": "823d8542bcdaea46c533eedb6148de31",
"packages": [
{
"name": "clue/stream-filter",
@ -7427,64 +7427,9 @@
"homepage": "https://symfony.com",
"time": "2019-11-12T14:51:11+00:00"
},
{
"name": "twig/extensions",
"version": "v1.5.4",
"source": {
"type": "git",
"url": "https://github.com/twigphp/Twig-extensions.git",
"reference": "57873c8b0c1be51caa47df2cdb824490beb16202"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/twigphp/Twig-extensions/zipball/57873c8b0c1be51caa47df2cdb824490beb16202",
"reference": "57873c8b0c1be51caa47df2cdb824490beb16202",
"shasum": ""
},
"require": {
"twig/twig": "^1.27|^2.0"
},
"require-dev": {
"symfony/phpunit-bridge": "^3.4",
"symfony/translation": "^2.7|^3.4"
},
"suggest": {
"symfony/translation": "Allow the time_diff output to be translated"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.5-dev"
}
},
"autoload": {
"psr-0": {
"Twig_Extensions_": "lib/"
},
"psr-4": {
"Twig\\Extensions\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
}
],
"description": "Common additional features for Twig that do not directly belong in core",
"keywords": [
"i18n",
"text"
],
"time": "2018-12-05T18:34:18+00:00"
},
{
"name": "twig/extra-bundle",
"version": "3.x-dev",
"version": "v3.0.0",
"source": {
"type": "git",
"url": "https://github.com/twigphp/twig-extra-bundle.git",
@ -7543,7 +7488,7 @@
},
{
"name": "twig/intl-extra",
"version": "3.x-dev",
"version": "v3.0.0",
"source": {
"type": "git",
"url": "https://github.com/twigphp/intl-extra.git",
@ -9454,8 +9399,6 @@
"aliases": [],
"minimum-stability": "stable",
"stability-flags": {
"twig/extra-bundle": 20,
"twig/intl-extra": 20,
"roave/security-advisories": 20
},
"prefer-stable": false,

View file

@ -16,8 +16,8 @@ return [
Omines\DataTablesBundle\DataTablesBundle::class => ['all' => true],
Shivas\VersioningBundle\ShivasVersioningBundle::class => ['all' => true],
FOS\CKEditorBundle\FOSCKEditorBundle::class => ['all' => true],
Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true],
Liip\ImagineBundle\LiipImagineBundle::class => ['all' => true],
Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['dev' => true, 'test' => true],
DAMA\DoctrineTestBundle\DAMADoctrineTestBundle::class => ['test' => true],
Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true],
];

View file

@ -1,11 +0,0 @@
services:
_defaults:
public: false
autowire: true
autoconfigure: true
# Uncomment any lines below to activate that Twig extension
#Twig\Extensions\ArrayExtension: ~
#Twig\Extensions\DateExtension: ~
Twig\Extensions\IntlExtension: ~
#Twig\Extensions\TextExtension: ~

View file

@ -688,20 +688,8 @@
"symfony/yaml": {
"version": "v4.2.3"
},
"twig/extensions": {
"version": "1.0",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "1.0",
"ref": "ddb2e0a77773b7fd75d8d649545f174e664500ab"
},
"files": [
"./config/packages/twig_extensions.yaml"
]
},
"twig/extra-bundle": {
"version": "3.x-dev"
"version": "v3.0.0"
},
"twig/intl-extra": {
"version": "3.x-dev"

View file

@ -11,7 +11,7 @@
<p class="form-control-plaintext">
{% if date(entity.addedDate) > date('1900/01/01') %}
{{ entity.addedDate | localizeddate("long") }}
{{ entity.addedDate | format_datetime("long") }}
{% else %}
-
{% endif %}
@ -24,7 +24,7 @@
<div class="col-md-9">
<p class="form-control-plaintext">
{% if date(entity.lastModified) > date('1900/01/01') %}
{{ entity.lastModified | localizeddate("long") }}
{{ entity.lastModified | format_datetime("long") }}
{% else %}
-
{% endif %}

View file

@ -56,8 +56,8 @@
</button>
<div class="dropdown-menu" aria-labelledby="btnGroupDrop1">
<span class="text-muted dropdown-item-text" ><i class="fas fa-lightbulb fa-fw"></i> <b>ID:</b> {{ attachment.iD }}</span>
<span class="text-muted dropdown-item-text" ><i class="fas fa-calendar fa-fw"></i> <b>{% trans %}createdAt{% endtrans %}:</b> {{ attachment.addedDate | localizeddate("short")}}</span>
<span class="text-muted dropdown-item-text" ><i class="fas fa-history fa-fw"></i> <b>{% trans %}createdAt{% endtrans %}:</b> {{ attachment.addedDate | localizeddate("short")}}</span>
<span class="text-muted dropdown-item-text" ><i class="fas fa-calendar fa-fw"></i> <b>{% trans %}createdAt{% endtrans %}:</b> {{ attachment.addedDate | format_datetime("short")}}</span>
<span class="text-muted dropdown-item-text" ><i class="fas fa-history fa-fw"></i> <b>{% trans %}createdAt{% endtrans %}:</b> {{ attachment.addedDate | format_datetime("short")}}</span>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#">{% trans %}attachment.edit{% endtrans %}</a>
<a class="dropdown-item" href="#">{% trans %}attachment.delete{% endtrans %}</a>

View file

@ -4,12 +4,12 @@
<tbody>
<tr> {# Creation date #}
<td>{% trans %}createdAt{% endtrans %}</td>
<td>{{ part.addedDate | localizeddate("long")}}</td>
<td>{{ part.addedDate | format_datetime("long")}}</td>
</tr>
<tr> {# Last modified date #}
<td>{% trans %}lastModified{% endtrans %}</td>
<td>{{ part.lastModified | localizeddate("long")}}</td>
<td>{{ part.lastModified | format_datetime("long")}}</td>
</tr>
<tr> {# ID #}

View file

@ -66,7 +66,7 @@
</button>
<div class="dropdown-menu">
<span class="text-muted dropdown-item-text" ><i class="fas fa-lightbulb fa-fw"></i> <b>ID:</b> {{ order.iD }}</span>
<span class="text-muted dropdown-item-text" ><i class="fas fa-history fa-fw"></i> <b>{% trans %}createdAt{% endtrans %}:</b> {{ order.addedDate | localizeddate("short")}}</span>
<span class="text-muted dropdown-item-text" ><i class="fas fa-history fa-fw"></i> <b>{% trans %}createdAt{% endtrans %}:</b> {{ order.addedDate | format_datetime("short")}}</span>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#"><i class="fas fa-edit fa-fw"></i> {% trans %}edit.caption_short{% endtrans %}</a>
<a class="dropdown-item" href="#"><i class="fas fa-trash fa-fw"></i> {% trans %}delete.caption{% endtrans %}</a>

View file

@ -37,7 +37,7 @@
<h6>
{% if lot.expirationDate %}
<span class="badge badge-info" title="{% trans %}part_lots.expiration_date{% endtrans %}">
<i class="fas fa-calendar-alt fa-fw"></i> {{ lot.expirationDate | localizeddate }}
<i class="fas fa-calendar-alt fa-fw"></i> {{ lot.expirationDate | format_datetime }}
</span>
{% endif %}
{% if lot.expired %}

View file

@ -2,11 +2,11 @@
<div class="mb-3">
<span class="text-muted" title="{% trans %}lastModified{% endtrans %}">
<i class="fas fa-history fa-fw"></i> {{ part.lastModified | localizeddate("short") }}
<i class="fas fa-history fa-fw"></i> {{ part.lastModified | format_datetime("short") }}
</span>
<br>
<span class="text-muted mt-1" title="{% trans %}createdAt{% endtrans %}">
<i class="fas fa-calendar-plus fa-fw"></i> {{ part.addedDate | localizeddate("short") }}
<i class="fas fa-calendar-plus fa-fw"></i> {{ part.addedDate | format_datetime("short") }}
</span>
</div>

View file

@ -47,11 +47,11 @@
</a>
<div class="">
<span class="text-muted" title="{% trans %}lastModified{% endtrans %}">
<i class="fas fa-history fa-fw"></i> {{ entity.lastModified | localizeddate("short") }}
<i class="fas fa-history fa-fw"></i> {{ entity.lastModified | format_datetime("short") }}
</span>
<br>
<span class="text-muted mt-1" title="{% trans %}createdAt{% endtrans %}">
<i class="fas fa-calendar-plus fa-fw"></i> {{ entity.addedDate | localizeddate("short") }}
<i class="fas fa-calendar-plus fa-fw"></i> {{ entity.addedDate | format_datetime("short") }}
</span>
</div>
</div>