Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [datetime]

Use it for questions about handling date or time through any module. Don't use it if you are already using "calendar" as tag.

-3
votes
0answers
12 views

Show the Content based on date of birth in Views

I am working on articles to be filtered by Date of Birth. Scenario : I added a DOB date field to article content type. Now, I have to show articles as , If today is the DOB of someone from content ...
0
votes
0answers
24 views

Need system wide time zone calculation ability

I need to hook into the time zone pipeline before date display to properly calculate "local" time events. It seems Drupal provides site and user time zone settings (and Views has its own TZ control ...
6
votes
2answers
491 views

My Date in Twig is ignoring format

I have a twig file with the following code in my Drupal 8.4.4 site: <div class="value col-md-12">{{ node.field_date.value }}</div> And in my content type, manage display option, I have ...
0
votes
1answer
52 views

Update the date field to the date & time of the node being updated

I am sure that I am missing something very simple here, so I hope somebody can put me on the right track. Use Case: I have a simple content type "Article" A date field of type: "Date and Time" is ...
1
vote
1answer
21 views

View date filter using years as an offset

Is there a way to use years as a date filter offset? What I want is to set it so that it it loads all content from the start of the previous year. So >= 01-01-2017 this year, >= 01-01-2018 next year, ...
1
vote
0answers
32 views

How to set a default date when extending DateRangeItem FieldType plugin

I created a new field type plugin that extends DateRangeItem. My plugin only adds some more settings. I also created an own widget that extends DateRangeWidgetBase. My formElement function looks like ...
1
vote
1answer
59 views

Date/Time +1h in Node

I have a module to import nodes with a date/time field. All times are correctly written into the database. But when I view a node or in node/edit I get the time +1 h. In Drupal I have set the timezone ...
0
votes
1answer
62 views

Views filter criteria date field is greater than current date

I have a overview page with different events. Now it shows all events which were created. But I will that it just shows all the future events. The content type has a datefield for the eventdate. I ...
0
votes
0answers
17 views

Dynamically set filter criteria in view - based on a date related calculation

I am trying to find a way to achieve this, but no matter how much I searched for 'dynamic filter criteria' and relevant info, I find no light .. I 'm fairly new to Drupal and haven't tackled anything ...
0
votes
1answer
14 views

Show content with a date after the current one on a view

I'm creating a calendar of events with Drupal 7 using views. At the moment the elements are shown in order of the date of each one (I have a date field where I put the date of the event). Now I need ...
0
votes
2answers
39 views

Insert date programatically in custom module

I am programatically saving values from an array $customer into a content type. The below code works fine and populates the content type customer_profile except for the field date of birth. This field ...
0
votes
1answer
22 views

Date popup field won't display in tableselect element

I am attempting to embed a couple of date fields within a tableselect element, and after trying to use both textfield and date_popup field types, I can't get either to work. Here's my form function ...
1
vote
1answer
54 views

How to programmatically set the user timezone

I am programmatically creating a user and wanted to assign a timezone for the user I am able to successfully create a user by the following code $user = \Drupal\user\Entity\User::create(); $user-&...
0
votes
0answers
25 views

How to use #date_time_callbacks to add jquery time picker

I would like to know how could I attach a jquery time picker to a datetime form element. I've made a module that displays a form. This form has datetime input element and I would like to use this ...
-1
votes
0answers
14 views

Relative optional date popup filter, sets default

I have looked everywhere and I just cannot get this right. I am building an analytics style tool that shows how impressions an advert has had for a specific campaign. The structure is as follows; ...
1
vote
1answer
29 views

Modify date popup structure

I would like to modify the date popup structure, in the image below you can see how date module builds the element. Drupal's default label is hidden, and it generates other to display the title. I ...
0
votes
1answer
48 views

How to add a time picker in datetime form elements

I have made a module that display a form. One of the form elements is a datetime field. $form['FirstDate'] = array( '#type' => 'datetime', '#title' => t('First date-time'), '#...
1
vote
2answers
54 views

Create a custom date format

Our organization's style guide expects dates in this format: Oct. 31 2018 01:30 p.m. I looked the date format drop-down in our views, and there were several options, including a custom one. ...
1
vote
1answer
19 views

Get all the machine names of the date formats

I have searched the Drupal documentation but until now I have not found the way to obtain the machine names of the date formats that the user creates from the Drupal administration. They would be the ...
0
votes
0answers
24 views

Why does changing date portion of a datetime string on node presave subtract an hour from the time portion?

I have two date fields, one only accepts date input and the other is only accepting time input (via the technique where you set the ['#date_date_element'] = 'none' as described in this answer). In ...
0
votes
0answers
15 views

Change date field; how to add timezone handling later

About date fields, this page https://www.drupal.org/node/767182 says If you start off without a time zone, but then realize that you need one at a later date [...] Perform the switch in the ...
0
votes
0answers
33 views

Filter a view by Date contextual filter not working

I have a content type with 3 fields: title field_a - textfield field_day - Date (Unix timestamp) field with day granularity So, for example, I can have two nodes like this: nid: 1 title: my title ...
0
votes
0answers
24 views

Change the HTML inputs in a datetime field

I have a multivalue datetime attribute where the date part is calculated from another field and then incremented based on the time part (e.g., start at the given day, 11pm; if the following time is ...
1
vote
1answer
22 views

Get all nodes where date field matches month and year

I have a content type with a date field (myFieldDate) whose values are timestamps. (I'm collecting only day, month, and year.) I have a custom form where I have a select list to select month and year....
0
votes
0answers
17 views

How can I format a date in 12 hour format?

I have tried all of the suggestions I can find but can't get the date module to display dates in 12 hour format. I have tried to use a custom date format with "h i" but no matter what I do dates are ...
0
votes
1answer
71 views

Import date field with feeds

I have a csv with a Date field that contains the date in one of the following formats: dd/mm/yy (ex. 13/11/04) dd/mm/yyyy (ex. 13/11/2004) I need to import these dates to my field in the format dd-...
0
votes
1answer
87 views

How can I get translation for a field of custom date

I am using the paragraphs module. I have a field which contains a date and time e.g. for events, which is added by an author. For the output I use a paragraph-twig-file and I have this: <div class=...
0
votes
1answer
218 views

Migration Source YML File import date string into date and time field of content type

I have a json file full of data exported from a wordpress site, one field being a string representing a date and time: "03/15/2012 14:46:19". I would like to import that string into a date and time ...
1
vote
1answer
28 views

How to retrieve value of start date with format end date?

I D8 installed the module Optional End Date in order to add an optional end date within a date field. When I had a single date field value I could get the value by using: $datum_deelname = $node-&...
0
votes
1answer
68 views

entityQuery with multivalue date field

Is there way to use entityQuery in order to select nodes with multiple value date field. For example we have a content type event with a field field_event_date which may contain unlimited number of ...
0
votes
1answer
87 views

Change the format of 'Authored on' date in views filter

In Drupal 8, I want to remove the timestamp on 'Authored on' date in views filter. Any Idea how to do this?
0
votes
1answer
69 views

Use created year as condition in Entity Query

I'm performing an entity query that searches for nodes of my custom content type called 'news'. I want to perform the query in a way that only produces the 'news' nodes that have a Authored Date that ...
0
votes
0answers
70 views

Settings and otions for Single Date Time Picker module

in my form I have decided to use Single Date Time Picker module since it gives a way to edit options of datepicker field via jQuery option list and it is also a time picker. So I added my custom ...
1
vote
1answer
30 views

How do you render a Node's Last Saved date in a Region Footer (ie, inside a Block on every page)?

I'm new to Drupal (8) and have no PHP experience, but I've managed to get this interesting CMS doing just about everything I need by playing with Twigs. I cannot for the life of me figure out how to ...
0
votes
0answers
13 views

Rules “Schedule component evaluation” not apply actions of component

I have the a Drupal site with enabled modules: Rules, Rules Scheduler Privatemsg & all submodules Date & all submodules Flag I created a content type "Event" with a date field (popup) and ...
0
votes
2answers
38 views

Partial start date with end date output views

I'm using views to output a list of nodes with dates. Some node dates have both a start and end date inserted. If both a start and end date exists, i would like the date to be outputted only taking ...
0
votes
1answer
182 views

How to convert a timestamp field into a date field?

Is there a way to convert the data of a timestamp field into a regular date field in Drupal 8? preferably without coding or making a new module.
0
votes
1answer
45 views

EntityQuery how to get all delta and good for field_dates

I've got these dates linked to a node. I just want to make a request to render all node when time() is between field_date_value AND field_date_end_value OR time() is < to field_date_value (ps: ...
0
votes
0answers
70 views

How do I convert a timestamp field to a date field?

After migrating about 34k nodes, I realized that this type of field is not compatible with the view exposed filters because it doesn't show the select date popup when it's exposed. I prefer not to ask ...
1
vote
0answers
51 views

How to remove the word “ago”? [closed]

I use Drupal 8 in French and I have never managed to delete the word "ago" which means nothing in French. How to remove the word "ago" in drupal 8? When I created a duration since, drupal added "ago"...
1
vote
2answers
762 views

Webform date field format

How do I change the date format of a date field in WEBFORM? I have enabled popup calendar for this field, and when I select a date from the calendar, the default format is in Y-m-d which I want to ...
0
votes
1answer
34 views

Group Views results by split year (academic, fiscal, etc.)

I have several content types with Date fields. I would like to build a View that groups that content by our academic year, e.g. 2015-2016, 2016-2017, 2017-2018, etc. I realize I would have to define ...
1
vote
1answer
29 views

How to set end date relative to start date in date range field

Is it possible to set the end date relative to the selected start date in a D8 date range field? I have a date range field that I use to specify an accounting period. The end date should now be put to ...
0
votes
1answer
133 views

How to add an attribute in an input date field

I want add the attribute autocomplete="Off" in the input field of the date field. I've created a modulo with hook_form_alter but not works. This is my code: function no_input_autocomplete_form_alter(&...
0
votes
0answers
27 views

How to display date picker and time picker in line?

When I set the time in "#date_format", a time picker is added below the date picker. How could I set it in the same row as the date picker? Code: $form['alert']['endDate'] = [ '#default_value' ...
0
votes
1answer
128 views

Date Time field machine name/view mode for theming using paragraphs

I am using Drupal 8 core DateTime Range module and Date module in core to list date start and end date. I have set various criteria and allowed content editors to set date/time under certain ranges ...
2
votes
2answers
116 views

Composer does not install Calendar Module

Hi I am having trouble migrating my local site to development (two seperate servers). I believe the reason being is because I can not install an unstable Calendar Module, which I have on my local but ...
0
votes
0answers
107 views

How to use datetime form api element in theme-settings.php (Drupal 8)

I have the following which displays as expected: function THEMENAME_form_system_theme_settings_alter(&$form, \Drupal\Core\Form\FormStateInterface &$form_state) { $date = DrupalDateTime::...
0
votes
1answer
57 views

Field type date bad formatting

i have a strange issue with a field "date". First i save it programatically this way : $now = new \DateTime(); $node->set('field_paiement_date' => DrupalDateTime::createFromTimestamp($now->...
2
votes
1answer
46 views

Why is this property of the Cron service initialized in this manner?

I wish someone could help me understand this code statement found on the core cRON service (\Drupal\Core\Cron), especially in the constructor method for this class. public function __construct(...