How to get rid of an extra space in a twig date field template? I have a twig date field template that has a mysterious extra blank space that I want to remove.

In my twig template, field--comerce-product--field-ppromotion-enddate.html.twig, I have the following line:

  &lt;div{{ item.attributes.addClass('field--item') }}&gt;&lt;span class="green"&gt;{{ item.content }}{{ 'TEXT'|trans }}&lt;/span&gt;&lt;/div&gt;


Unfortunately, the printed output looks like this:

2017-12-25 TEXT

I don't know where the space is coming from.

I am using a similar template for an integer field that has this line:

  &lt;div{{ item.attributes.addClass('field--item') }}&gt;&lt;span class="discount"&gt;{{ item.content }}{{ 'OFF!'|trans }}&lt;/span&gt;&lt;/div&gt;


This prints the discount percentage (integer field) and then the word "off" (example: 20%off)-- there is no space between the percentage and off, which is what I want.

(Why no space? My site actually uses an Asian language that doesn't use spaces.)

So where is this space coming from on the date field?  When the date field content is printed, it uses the template time.html.twig, but the content of that template is this single line (skipping the comments):

&lt;time{{ attributes }}&gt;{{ text }}&lt;/time&gt;


EDIT: Based on the suggested answers, I have tried {{- foo -}} to remove the whitespace around the date and text, as well as {%spaceless%} to remove other whitespace, but the extra space is still there between the date and the text):

  {% spaceless %}
    &lt;div{{ item.attributes.addClass('field--item') }}&gt;&lt;span class="green"&gt;{{- item.content -}}{{- 'TEXT'|trans -}}&lt;/span&gt;&lt;/div&gt;
  {% endspaceless %}


Actual output of this code: 2017年12月25日 TEXT

Output should be: 2017年12月25日TEXT
You can also use Trim, if doesn't work please check this answer.