How to preprocess view field? I have view with one date field. Now I want to preprocess this date field(lets say I want to change the date format).

Twig file override : views-view-field--field_date.html.twig

Prepocess code I have tried but kint is showing me only DEPTH TOO GREAT value.

function my_sub_theme_preprocess_views_view_field__field_date(&amp;$variables) {
    kint($variables['view']);
}


Please let me know how to preprocess this field. Is it possible to change date format in twig itself?
The output of views field templates is flat markup. You can't change a render array like you can in field templates when rendering entities in view modes.

So if you want to change the output you have to start from scratch with the values that are in the database. In views field templates you can use the getValue() method from the field variable. As parameter you have to provide row:

{{ field.value(row) }}


The result is a single value or an array for multivalue fields.

Example

views-view-field--created.html.twig

The raw value from created is a unix timestamp

Timestamp: {{ field.value(row) }}


You can use the timestamp for example to reformat the date with the date filter from twig:

Date: {{ field.value(row)|date("m/d/Y") }}