Use localizeddate for showing date information in templates.

This commit is contained in:
Jan Böhmer 2019-03-05 14:23:38 +01:00
parent af5a7f8986
commit b090f1b716
7 changed files with 86 additions and 4 deletions

1
.gitignore vendored
View file

@ -19,6 +19,7 @@
.idea/
.idea/*
###> symfony/webpack-encore-bundle ###
/node_modules/
/public/build/

1
.idea/php.xml generated
View file

@ -113,6 +113,7 @@
<path value="$PROJECT_DIR$/vendor/doctrine/persistence" />
<path value="$PROJECT_DIR$/vendor/ocramius/proxy-manager" />
<path value="$PROJECT_DIR$/vendor/symfony/webpack-encore-bundle" />
<path value="$PROJECT_DIR$/vendor/twig/extensions" />
</include_path>
</component>
<component name="PhpProjectSharedConfiguration" php_language_level="7.1" />

View file

@ -24,7 +24,9 @@
"symfony/validator": "4.2.*",
"symfony/web-link": "4.2.*",
"symfony/webpack-encore-bundle": "^1.1",
"symfony/yaml": "4.2.*"
"symfony/yaml": "4.2.*",
"twig/extensions": "^1.5",
"webmozart/assert": "^1.4"
},
"require-dev": {
"symfony/debug-pack": "*",

57
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "54e0b48ecf19934241734a4229c9b47f",
"content-hash": "b7f3621e8185fed6caafdf0430d434c3",
"packages": [
{
"name": "doctrine/annotations",
@ -5147,6 +5147,61 @@
"homepage": "https://symfony.com",
"time": "2019-02-23T15:17:42+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/twig",
"version": "v2.6.2",

View file

@ -0,0 +1,11 @@
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

@ -500,6 +500,18 @@
"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/twig": {
"version": "v2.6.2"
},

View file

@ -198,7 +198,7 @@
<div class="form-group">
<label>{% trans %}createdAt{% endtrans %}:</label>
<p>{{ part.addedDate | date}}
<p>{{ part.addedDate | localizeddate("long")}}
{#{if !empty($creation_user)} {% trans %}by{% endtrans %}
{if $can_visit_user}
<a href="{$relative_path}user_info.php?uid={$creation_user_id}">{$creation_user}</a>
@ -213,7 +213,7 @@
<div class="form-group">
<label>{% trans %}lastModified{% endtrans %}:</label>
<p>{{ part.lastModified | date }}
<p>{{ part.lastModified | localizeddate("long") }}
{# {if !empty($last_modified_user)} {% trans %}by{% endtrans %}
{if $can_visit_user}
<a href="{$relative_path}user_info.php?uid={$last_modified_user_id}">{$last_modified_user}</a>