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.

Filter by
Sorted by
Tagged with
0
votes
0answers
25 views

How to access data in Twig in module extended template

I'm new at developing Drupal. I'm using Drupal 8 and I want to display datetime fields in a special way. Here is how my module_name.module and template file looks like: function module_name_theme($...
-2
votes
0answers
21 views

Date format for date type fields

I am using a date type fields in a custom form after click on the date pop up I want the date format in mm-dd-yyyy or yyyy-mm-dd but currently its showing dd-mm-yyyy. $form['start_date'] = [ '#type' ...
1
vote
1answer
53 views

how to convert date into timestamp using timezone

I am using strtotime to convert date into time stamp but its does not work correctly. I know its relatively to time zone. My drupal store time zone is denver. I am not sure why its not showing correct ...
1
vote
1answer
18 views

Is there a way to limit the time zones available to the user to select from?

We have a Drupal 9 site that has a Smart Date field with Time Zones. However, the time zone selection list is huge. We want to limit it to the four main US times zones. Is this possible?
2
votes
0answers
20 views

old dates in datetime field

I need to be able to enter old dates. I am not allowed to enter anything prior 1880. Using drupal 9, datetime field. Daterange does not allow to enter anything before 1900. Any workaround or solution?
1
vote
0answers
28 views

Can't save value of custom datetime field

I'm reaching out because I just can't find out why my custom datetime field isn't saving its value after I submit. Context: I've created a field containing two datetime fields. I will use it to add or ...
-1
votes
1answer
29 views

Migrating date into drupal datetime field

i am having the xml selector <starting_date><![CDATA[ 2017-01-01 22:34:56 +0100 ]]></starting_date> this migration process fails : process: field_job_starting_date: plugin: ...
1
vote
1answer
16 views

Custom field formatter fails in create()

PHPStorm, PHP 7.4 IDE highlights $container->get('date.formatter'), with "Expected parameter of type '\Drupal\Core\Datetime\DateFormatterInterface', 'object' provided" This function is ...
2
votes
0answers
44 views

Is there a way to restrict time zone options in the DateTimeRange field widget?

Is there a way to limit the options of the timezone field in the datetime or datetime range widget in Drupal 8? It currently shows tons of timezones, but we really only need about 10 options. I ...
0
votes
1answer
32 views

Filling in default value for datetime field in custom entity

I am trying to set the default value for the date field in a custom Entity. The code does not produce any errors. The date field does just not populate with any value. How can I set the default value? ...
0
votes
0answers
18 views

Change booking end-date in iCal Feeds import

I have an D9 site for a villa that can be rented. To show availability, I import the iCal calendar of bookings from a booking site, using the Feeds and Feeds iCal modules (the last one I updated the ....
1
vote
0answers
20 views

Programmatically set a views filter value on page load (not contextual filter)

I have created some views for an Events content type with field_start and field_end timestamp fields. One of the displays is for 'Upcoming Events'. I want to filter only those events whose start date ...
-1
votes
1answer
43 views

How can i change dateformat of webform submission

Is there a way where we could change the date format of the form submission? For Example in the Webform I have created there's no date picker in it. But when the web form is submitted by the user by ...
0
votes
0answers
7 views

Rewriting Start and End Dates in Views where Date is stored in single field

using Drupal 7, I have the Profile2 module installed. Within that, I have a field called "Employment Dates" and a user can enter a start and end date on this field. They can also leave the ...
1
vote
0answers
16 views

Adding a relative date range facet to a Search API view using the "last updated" field

I would like to add a facet to a search_api view filtering on the content "changed" field. I would like to use friendly naming like "This week", "This month" etc. There ...
0
votes
0answers
30 views

How can I test code that uses cron for scheduling?

I have some custom code on my site that schedules emails to be sent. When an email is set, a user account field is updated. So I want to write a test that: Jumps forward in time into the future ...
1
vote
1answer
679 views

How do I compare a date field with the current time in a twig template?

I have a date field on a node – set to a custom date format (c which is ISO) in the Manage Display. I have a twig template checking to see if that date field comes before today, in which is should ...
0
votes
1answer
72 views

Views exposed filter by season from date field (date range group as month only?)

How would I create an exposed filter by season (spring, summer, fall, winter) based on date fields? I figured the approach would be to create date range filter groups by MONTH only (no year), but I ...
0
votes
2answers
279 views

How to change date format in the webform date element?

I have added a date element to my webform. Now I want to change the date format for the date element. I have used the following code. function my_module_webform_element_alter(array &$element, ...
0
votes
0answers
19 views

How to get date value from Smart Date field

What is the method for getting the start date value from a Smart Date field? $s_dates = $service->get('field_date')->getValue(); dpm($s_dates); gives me the output: array:6 [▼ "value&...
0
votes
0answers
16 views

"created date" issue with multiple languages

I am working on a site with 3 languages: English, Finnish, and Swedish. The default language is Finnish; the site is using English and Swedish translations. I sent a request to Drupal with Postman ...
1
vote
1answer
18 views

View based on months or days - display certain items during specified times of the year

I am trying to create a calendar-type view that will display links to specific nodes during certain months of the year. For example, this would show 'Taxes' in Feb and April, 'Travel' from May to ...
1
vote
1answer
57 views

Exposed date filter against >= "today" fails until 5pm Mountain time

I added a Date only date field named expires to the user profile. The expires field has the value 2021-01-08 for a certain user (I checked the database; it has no time component). In a view, I have an ...
1
vote
1answer
161 views

Migrate date time field using migrate source csv

I am trying to migrate a datetime field from csv file but only few are being migrating and other are being failed.I am using migrate I have created two datetime fields called as Activation Date and ...
0
votes
0answers
70 views

How does core handle the different time zones?

Here is my situation, I have a website where the content author(i.e who has his preferred time zone as PST in US) had created the node of one content type which had an event in New York(i.e a ...
1
vote
0answers
46 views

Filter nodes that have a field date that is not in the future

I have a view setup to list nodes that have "public date" date field that are in the past. To do that, the filter is doing a Content: Field Public Date <= today. "today" if the ...
0
votes
0answers
39 views

Relative date filter views block is cached for anonymous users

Drupal 7.74, views 3.24 (latest) I have a view which uses a date field to filter and shows on: less than or equal to "now" I display the view in a block. With caching for anonymous enabled, (...
0
votes
2answers
54 views

Display multiple timezone values from a single date/time entry

In Drupal 7 Views Date/Time field, is there a way to generate multiple timezone values from a single event date, with start and end values? For example, if an event is entered into the start/end Time ...
0
votes
0answers
39 views

How to accept multiple date formats for date field in webform module (with and without leading zeros)?

I have webform created with webform module. Inside it I have date field which should accept person's date of birth. When I edit that filed I can set date format at "Date settings" section, &...
-2
votes
1answer
49 views

How do I display only products that do not exceed the end date?

I created in my product type, a "Date interval" field. I created a view that contains this field. With a start date and an end date. I want my view to show only products that are within the ...
1
vote
2answers
174 views

How do I migrate dates?

In my Drupal 7 site, the date is stored in the database as 2020-08-10 00:00:00. When I migrate those dates without any formatting (field_blog_post_date: field_blog_post_date), the date is migrated ...
0
votes
1answer
32 views

Changing existing date time field

I am working on an already existing site that has content. There is a content type with field date and time. I need to remove the time component and just be Date only without deleting any content ...
1
vote
1answer
205 views

How can I change the date format for user submitted data in confirmation emails

The confirmation emails sent by Webform (running under Drupal 8.9.7) on submission are in US format "m/d/Y" for all date fields that the user entered on the form (but not for system ...
1
vote
0answers
60 views

Posting date when a submission is made

I am a newbie at Drupal, so apologies if I am missing something obvious. I searched the issues with various keywords but could not find a similar problem. I need some data to be sent via remote post ...
3
votes
1answer
463 views

Date Field Type - Text Field Widget is Gone?

I am noticing that the Date field type only has the availability of three widgets: Select list Date and time Select list, no time Can someone tell me why the "Text Field" widget is gone? ...
0
votes
1answer
74 views

In Views, when using a filter on a datetime field, what is the time zone of the offset?

When I use an offset like "-4 hours" in a Views filter on a datetime field, which timezone is used? More details In Views, when I add a filter for a datetime field, I get the following ...
0
votes
0answers
102 views

Date time save in database

I have two very basic vanilla installation of Drupal 8. One I have installed a few months back, and one I installed today. I have an identical datetime range field in both of them. But I noticed that ...
1
vote
1answer
72 views

How do I translate the weekday in a date?

I created a view from a JSON file; the dates in that file follow the 2020-07-28 20:00 format. I do a rewrite of the date to <span>{{ value_1|date("l d/m/Y") }}</span> and I get ...
0
votes
0answers
232 views

How do I change the date format of a date field?

How to change date format of date field? I'm using webform module. There is no date format field to set it. Also read somewhere that changing default date format of "short" format will do ...
1
vote
1answer
122 views

How can I show a date in Urdu?

I am working on printing dates in more than a language. With Drupal 7, I used the following code. <span class="arabic-date"> <?php $arrayurdudays = array('', '', '', '', '', '', ...
0
votes
1answer
57 views

Why doesn't my date get rendered?

In Drupal 8, I have a Flag entity with a date field attached. My code looks like this: function MYMODULE_flagging_presave(FlaggingInterface $flagging) { if ($score == 0 || $score == 1) { $...
0
votes
0answers
26 views

Filter view results by "created"/"authored on" date - shows all content regardless of post date

I've been throwing myself at this for a while, apologies if I've missed anything stupidly obvious. I'm trying to create a table of statistics for content submitted by all users (using Views Aggregator ...
1
vote
1answer
313 views

How can I programmatically set date field Month, Day, Year dropdowns in Paragraphs?

I'm setting a basic date field (and several other text fields) programmatically when creating a paragraph. The database is showing that it is getting my date, which is being stored inY-m-d\TH:i:s ...
1
vote
1answer
332 views

Change exposed filter date format with Search API

We are using Search API for a customer website and we have a View with a start and end date exposed filter. The view only filters correctly if we use the m/d/Y format, which is not valid in Brazil, ...
1
vote
1answer
480 views

Programmatically set the value of a date/Time field

I am trying to copy the value of a Date/Time Webform element to a Date/Time field set on the article node. Below is the source code of the Date/Time Webform element: expiry_date: '#type': datetime ...
0
votes
1answer
227 views

Change the value of a taxonomy field on cron run

I have the article node with two extra fields: Taxonomy reference field field_verification_status with two possible values: Valid (tid: 272) Expired (tid: 271) Date field (field_article_expiry_date)...
0
votes
0answers
54 views

Upcoming birthday list in views, based on birth date

In Drupal 8 I created some extra fields at "user", such as date of birth" (dd-mm-yyyy) I want to show in a block in views the upcoming birthdays. BUT...I can't sort them on date, because the order ...
0
votes
1answer
1k views

Filter nodes by today's date

Following what described in Views filter criteria date field is greater than current date, I have used operator >= today with some success. I would like to create "future" nodes and they should be ...
0
votes
1answer
517 views

How to limit form submission per user per day and week?

The goal is very straightforward. I need a form to limit each user to 1 submission per day and 3 per week. What I found: Webform: The "Form settings" in webform has the "Per user submission limit" ...
0
votes
0answers
451 views

Date range issues with timezones in twig

We're using date ranges for some events in an application. We're finding that when we use the date value and end_value independent of one another then the timezone is incorrect. For example, inside a ...

1
2 3 4 5
25