{"id":14968687,"url":"https://github.com/vallic/single_datetime","last_synced_at":"2025-10-26T05:30:38.422Z","repository":{"id":63002531,"uuid":"83969078","full_name":"Vallic/single_datetime","owner":"Vallic","description":"Drupal 8 date time picker form element using the  xdan jQuery Plugin Date and Time Picker library ","archived":false,"fork":false,"pushed_at":"2021-09-24T20:08:12.000Z","size":78,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"8.x-1.x","last_synced_at":"2025-02-05T20:10:46.951Z","etag":null,"topics":["datetime","datetime-range-fields","drupal","drupal-8","drupal-module","drupal-modules","drupal8","exposed-filters","jquery-datepicker"],"latest_commit_sha":null,"homepage":"https://vallic.com","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Vallic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-05T12:43:03.000Z","updated_at":"2022-09-20T14:12:08.000Z","dependencies_parsed_at":"2022-11-10T18:02:21.670Z","dependency_job_id":null,"html_url":"https://github.com/Vallic/single_datetime","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vallic%2Fsingle_datetime","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vallic%2Fsingle_datetime/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vallic%2Fsingle_datetime/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vallic%2Fsingle_datetime/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Vallic","download_url":"https://codeload.github.com/Vallic/single_datetime/tar.gz/refs/heads/8.x-1.x","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238264672,"owners_count":19443388,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["datetime","datetime-range-fields","drupal","drupal-8","drupal-module","drupal-modules","drupal8","exposed-filters","jquery-datepicker"],"created_at":"2024-09-24T13:40:24.333Z","updated_at":"2025-10-26T05:30:33.139Z","avatar_url":"https://github.com/Vallic.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"CONTENTS OF THIS FILE\n---------------------\n\n * Introduction\n * Requirements\n * Installation\n * Configuration\n * Views exposed filters\n * Maintainers\n\n\nINTRODUCTION\n------------\n\nThe Single Date Time Picker module supports date/time and date fields. You can\nuse it on Datetime and Datetime Range fields.\n\nFeatures:\n\n * Support Datetime and Datetime Range field types\n * Support for Views exposed filters\n * 12/24 hour format display\n * Option to choose granularity for minutes\n * Option to disable specific days global (etc. Saturday)\n * Option to disable specific dates, useful for holidays, working days, etc.\n\n * For a full description of the module visit:\n   https://www.drupal.org/project/single_datetime\n\n * To submit bug reports and feature suggestions, or to track changes visit:\n   https://www.drupal.org/project/issues/single_datetime\n\n\nREQUIREMENTS\n------------\n\nThis module requires the following outside of Drupal core:\n\n * Plugin Date and Time Picker library - https://github.com/xdan/datetimepicker\n\n\nINSTALLATION\n------------\n\n * Install the Single Date Time Picker module as you would normally install a\n   contributed Drupal module. Visit https://www.drupal.org/node/1897420 for\n   further information.\n * Install external library from xdan trough composer or manual. Library\n   should be available at yourdrupalsite.com/libraries/datetimepicker\n\n    1. Manual\n       Download https://github.com/xdan/datetimepicker/archive/2.5.20.zip,\n       and extract inside drupal root folder: libraries/datetimepicker\n\n    2. Using Drupal library definition.\n\n       [Ensure composer packages of type drupal-library are configured to install to the appropriate path.](https://www.drupal.org/docs/develop/using-composer/using-composer-to-install-drupal-and-manage-dependencies#installer-dirs)\n    ```\n    \"extra\": {\n        \"drupal-libraries\": {\n            \"jquery-datetimepicker\": \"https://github.com/xdan/datetimepicker/archive/2.5.20.zip\"\n         },\n    }\n    ```\n    3. Composer as npm asset.\n       `composer require \"npm-asset/jquery-datetimepicker\":\"^2.5\"`\n\n       [Ensure composer packages of type npm-asset are\n       configured to install to the appropriate path.](https://www.drupal.org/docs/develop/using-composer/using-composer-to-install-drupal-and-manage-dependencies#third-party-libraries)\n\n    4. Using packagist for JS libraries\n       https://asset-packagist.org/\n\nCONFIGURATION\n-------------\n\n    1. Navigate to Administration \u003e Extend and enable the module.\n    2. Navigate to Administration \u003e Structure \u003e Content types \u003e [Content type\n       with date field] \u003e Manage form display.\n    3. Select the date field to edit and choose \"Single Date Time Picker\" from\n       Widget drop down.\n    4. Edit the Field Plugin Setting by selecting the gear icon.\n    5. Select the hours format: 12 hours or 24 hours.\n    6. Select granularity for minutes in calendar: 5, 10, 15, 30, or 60 minutes.\n    7. Select days which are to be disabled in calendar.\n    8. To disable specific dates from calendar enter days in following format\n       d.m.Y etc. 31.12.2018. Each date in new line. This is used for specific\n       dates.\n    9. Update and Save.\n\n\nVIEWS EXPOSED FILTERS\n-------------\n\nThis module contains submodule `single_datetime_exposed`.\nIf you enable it, all exposed filters of types `date` and `search_api_date` will\nautomatically use date time picker on exposed filters.\n\nIt works with all operators, and none configuration is needed.\nIf you need customized configuration, suggesting that you create your\nimplementation based on this submodule.\n\nFORM API USAGE\n-------------\nYou can use SingleDateTime in other parts of the Drupal FORM API with minor\nadjustments. If you are using non single_datetime elements, as textfield field\ntype, you need to attach proper attributes on the field, and attach JS library\n(see examples below).\n\nSecond choice is that you can create custom field of field type\nsingle_datetime directly.\n\nAlso exist helper `\\Drupal\\single_datetime\\AttributeHelper` with some default\nattributes options and examples. See examples below.\n\n\n\n**Custom single_datetime field**\nUsing AttributeHelper you can create default widget:\n\n```\n$form['purchase_date'] = [\n '#title' =\u003e 'Purchase date',\n '#type' =\u003e 'single_date_time',\n '#date_timezone' =\u003e date_default_timezone_get(),\n '#default_value' =\u003e NULL,\n '#date_type' =\u003e  'datetime',\n '#required' =\u003e TRUE,\n] + \\Drupal\\single_datetime\\AttributeHelper::allElementAttributes();\n ```\n\n\nDirectly using your attributes.\n```\n $form['purchase_date'] = [\n    '#title' =\u003e 'Purchase date',\n    '#type' =\u003e 'single_datetime',\n    '#time' =\u003e FALSE,\n    '#required' =\u003e TRUE,\n    '#hour_format' =\u003e 24,\n    '#first_day' =\u003e \\Drupal::config('system.date')-\u003eget('first_day'),\n    '#disable_days' =\u003e [],\n    '#allow_times' =\u003e 60,\n    '#allowed_hours' =\u003e Json::encode(range(0, 23)),\n    '#inline' =\u003e '0',\n    '#mask' =\u003e FALSE,\n    '#datetimepicker_theme' =\u003e 'default',\n    '#single_date_time' =\u003e 'datetime',\n    '#exclude_date' =\u003e '',\n    '#min_date' =\u003e '',\n    '#max_date' =\u003e '',\n    '#year_start' =\u003e '1970',\n    '#year_end' =\u003e date('Y'),\n ];\n ```\n\n**Textfield or any other field type**\n\nUsing AttributeHelper you can create default widget:\n```// Using datetimepicker module.\n $form['purchase_date'] = [\n   '#title' =\u003e 'Purchase date',\n   '#type' =\u003e 'textfield',\n   '#time' =\u003e FALSE,\n   '#required' =\u003e TRUE,\n   '#attributes' =\u003e \\Drupal\\single_datetime\\AttributeHelper::defaultWidget(),\n ];\n $form['#attached']['library'][] = 'single_datetime/datetimepicker';\n $form['#attributes']['autocomplete'] = 'off';\n ```\n\n\nDirectly using your attributes.\n```// Using datetimepicker module.\n $form['purchase_date'] = [\n   '#title' =\u003e 'Purchase date',\n   '#type' =\u003e 'textfield',\n   '#time' =\u003e FALSE,\n   '#required' =\u003e TRUE,\n   '#attributes' =\u003e [\n     'data-first-day' =\u003e '0',\n     'data-disable-days' =\u003e [],\n     'data-inline' =\u003e '0',\n     'data-datetimepicker-theme' =\u003e 'default',\n     'data-single-date-time' =\u003e 'date',\n     'data-max-date' =\u003e date('Y-m-d'),\n     'data-year-start' =\u003e '2005',\n     'data-year-end' =\u003e date('Y'),\n   ],\n ];\n $form['#attached']['library'][] = 'single_datetime/datetimepicker';\n $form['#attributes']['autocomplete'] = 'off';\n ```\n\n\n\nMAINTAINERS\n-----------\n\n * Valentino Međimorec (valic) - https://www.drupal.org/u/valic\n\nSupporting organization:\n\n * Vallic - https://www.drupal.org/vallic\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvallic%2Fsingle_datetime","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvallic%2Fsingle_datetime","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvallic%2Fsingle_datetime/lists"}