{"id":19133907,"url":"https://github.com/fulcrum6378/mcdtp","last_synced_at":"2026-05-19T07:36:26.247Z","repository":{"id":164427211,"uuid":"639823208","full_name":"fulcrum6378/mcdtp","owner":"fulcrum6378","description":"Multi-Calendar Date Time Picker, a library for Android with the ability to support any subclass of android.icu.util.Calendar (API 24+) as its default calendar. Forked from Material Date Time Picker belonging to @wdullaer.","archived":false,"fork":false,"pushed_at":"2024-09-23T14:20:10.000Z","size":998,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-22T17:47:10.478Z","etag":null,"topics":["android","datepicker","datetimepicker","library"],"latest_commit_sha":null,"homepage":"","language":"Java","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/fulcrum6378.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-12T09:59:39.000Z","updated_at":"2024-09-23T14:20:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"f6e4b5b3-e09d-4699-a440-6e7aadf0a864","html_url":"https://github.com/fulcrum6378/mcdtp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fulcrum6378/mcdtp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fulcrum6378%2Fmcdtp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fulcrum6378%2Fmcdtp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fulcrum6378%2Fmcdtp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fulcrum6378%2Fmcdtp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fulcrum6378","download_url":"https://codeload.github.com/fulcrum6378/mcdtp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fulcrum6378%2Fmcdtp/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263154344,"owners_count":23422009,"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":["android","datepicker","datetimepicker","library"],"created_at":"2024-11-09T06:24:21.599Z","updated_at":"2026-05-19T07:36:26.178Z","avatar_url":"https://github.com/fulcrum6378.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Multi-Calendar Date Time Picker\n\nMulti-Calendar Date Time Picker is a forked version of \n[Material Date Time Picker](https://github.com/wdullaer/MaterialDateTimePicker),\nwith the ability to support any subclass of\n[android.icu.util.Calendar](https://developer.android.com/reference/android/icu/util/Calendar)\nas its default calendar. (Support for Android 7.0 and up)\n\nI also added font resources support to it and migrated it to AndroidX, with up-to-date dependencies.\n\nThe library\nuses [the code from the Android frameworks](https://android.googlesource.com/platform/frameworks/opt/datetimepicker/) as\na base and tweaked it to be as close as possible to Material Design example.\n\n**Version 2 Layout**\n\n Date Picker                                                                                               | Time Picker                                                                                               \n-----------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------\n ![Date Picker](https://raw.github.com/wdullaer/MaterialDateTimePicker/gh-pages/images/date_picker_v2.png) | ![Time Picker](https://raw.github.com/wdullaer/MaterialDateTimePicker/gh-pages/images/time_picker_v2.png) \n\n**Version 1 Layout**\n\n Date Picker                                                                                            | Time Picker                                                                                            \n--------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------\n ![Date Picker](https://raw.github.com/wdullaer/MaterialDateTimePicker/gh-pages/images/date_picker.png) | ![Time Picker](https://raw.github.com/wdullaer/MaterialDateTimePicker/gh-pages/images/time_picker.png) \n\n## Using Material Date/Time Pickers\n\nThe library follows the same API as other pickers in the Android framework.\nFor a basic implementation, you'll need to\n\n1. Implement an `OnTimeSetListener`/`OnDateSetListener`\n2. Create a `TimePickerDialog`/`DatePickerDialog` using the supplied factory\n3. Theme the pickers\n\n### Implement an `OnTimeSetListener`/`OnDateSetListener`\n\nIn order to receive the date or time set in the picker, you will need to implement the `OnTimeSetListener` or\n`OnDateSetListener` interfaces. Typically this will be the `Activity` or `Fragment` that creates the Pickers. The\ncallbacks use the same API as the standard Android pickers.\n\n```java\n@Override\npublic void onTimeSet(RadialPickerLayout view, int hourOfDay, int minute, int second) {\n  String time = \"You picked the following time: \"+hourOfDay+\"h\"+minute+\"m\"+second;\n  timeTextView.setText(time);\n}\n\n@Override\npublic void onDateSet(DatePickerDialog view, int year, int monthOfYear, int dayOfMonth) {\n  String date = \"You picked the following date: \"+dayOfMonth+\"/\"+(monthOfYear+1)+\"/\"+year;\n  dateTextView.setText(date);\n}\n```\n\n### Create a `TimePickerDialog`/`DatePickerDialog` using the supplied factory\n\nYou will need to create a new instance of `TimePickerDialog` or `DatePickerDialog` using the static `newInstance()`\nmethod, supplying proper default values and a callback. Once the dialogs are configured, you can call `show()`.\n\n```java\nCalendar now = Calendar.getInstance();\nDatePickerDialog dpd = DatePickerDialog.newInstance(\n  MainActivity.this,\n  now.get(Calendar.YEAR), // Initial year selection\n  now.get(Calendar.MONTH), // Initial month selection\n  now.get(Calendar.DAY_OF_MONTH) // Inital day selection\n);\n// If you're calling this from a support Fragment\ndpd.show(getFragmentManager(), \"Datepickerdialog\");\n// If you're calling this from an AppCompatActivity\n// dpd.show(getSupportFragmentManager(), \"Datepickerdialog\");\n```\n\n### Theme the pickers\n\nThe library contains 2 layout versions for each picker.\n\n* Version 1: this is the original layout. It is based on the layout google used in the kitkat and early material design\n  era\n* Version 2: this layout is based on the guidelines google posted when launching android marshmallow. This is the\n  default and still the most current design.\n\nYou can set the layout version using the factory\n\n```java\ndpd.setVersion(DatePickerDialog.Version.VERSION_2);\n\n## Additional Options\n\n### [TimePickerDialog] `setTitle(String title)`\n\nShows a title at the top of the `TimePickerDialog`\n\n### [DatePickerDialog] `setTitle(String title)`\n\nSet a custom text for the dialog Ok and Cancel labels. Can take a resourceId of a String. Works in both the\nDatePickerDialog and TimePickerDialog\n\n### [DatePickerDialog] `setMinDate(Calendar day)`\n\nSet the minimum valid date to be selected. Date values before this date will be deactivated\n\n### [DatePickerDialog] `setMaxDate(Calendar day)`\n\nSet the maximum valid date to be selected. Date values after this date will be deactivated\n\n### [TimePickerDialog] `setMinTime(Timepoint time)`\n\nSet the minimum valid time to be selected. Time values earlier in the day will be deactivated\n\n### [TimePickerDialog] `setMaxTime(Timepoint time)`\n\nSet the maximum valid time to be selected. Time values later in the day will be deactivated\n\n### [TimePickerDialog] `setSelectableTimes(Timepoint[] times)`\n\nYou can pass in an array of `Timepoints`. These values are the only valid selections in the\npicker. `setMinTime(Timepoint time)`, `setMaxTime(Timepoint time)` and `setDisabledTimes(Timepoint[] times)` will\nfurther trim this list down. Try to specify Timepoints only up to the resolution of your picker (i.e. do not add seconds\nif the resolution of the picker is minutes).\n\n### [TimePickerDialog] `setDisabledTimes(Timepoint[] times)`\n\nYou can pass in an array of `Timepoints`. These values will not be available for selection. These take precedence\nover `setSelectableTimes` and `setTimeInterval`. Be careful when using this without selectableTimes: rounding to a valid\nTimepoint is a very expensive operation if a lot of consecutive Timepoints are disabled. Try to specify Timepoints only\nup to the resolution of your picker (i.e. do not add seconds if the resolution of the picker is minutes).\n\n### [TimePickerDialog] `setTimeInterval(int hourInterval, int minuteInterval, int secondInterval)`\n\nSet the interval for selectable times in the TimePickerDialog. This is a convenience wrapper\naround `setSelectableTimes`. The interval for all three time components can be set independently. If you are not using\nthe seconds / minutes picker, set the respective item to 60 for better performance.\n\n### [TimePickerDialog] `setTimepointLimiter(TimepointLimiter limiter)`\n\nPass in a custom implementation of `TimeLimiter`\nDisables `setSelectableTimes`, `setDisabledTimes`, `setTimeInterval`, `setMinTime` and `setMaxTime`\n\n### [DatePickerDialog] `setSelectableDays(Calendar[] days)`\n\nYou can pass a `Calendar[]` to the `DatePickerDialog`. The values in this list are the only acceptable dates for the\npicker. It takes precedence over `setMinDate(Calendar day)` and `setMaxDate(Calendar day)`\n\n### [DatePickerDialog] `setDisabledDays(Calendar[] days)`\n\nThe values in this `Calendar[]` are explicitly disabled (not selectable). This option can be used together\nwith `setSelectableDays(Calendar[] days)`: in case there is a clash `setDisabledDays(Calendar[] days)` will take\nprecedence over `setSelectableDays(Calendar[] days)`\n\n### [DatePickerDialog] `setHighlightedDays(Calendar[] days)`\n\nYou can pass a `Calendar[]` of days to highlight. They will be rendered in bold. You can tweak the color of the\nhighlighted days by overwriting `date_picker_text_highlighted`\n\n### [DatePickerDialog] `showYearPickerFirst(boolean yearPicker)`\n\nShow the year picker first, rather than the month and day picker.\n\n### [All] `OnDismissListener` and `OnCancelListener`\n\nBoth pickers can be passed a `DialogInterface.OnDismissLisener` or `DialogInterface.OnCancelListener` which allows you\nto run code when either of these events occur.\n\n```java\ntpd.setOnCancelListener(new DialogInterface.OnCancelListener() {\n    @Override\n    public void onCancel(DialogInterface dialogInterface) {\n      Log.d(\"TimePicker\", \"Dialog was cancelled\");\n    }\n});\n```\n\n### [All] `vibrate(boolean vibrate)`\n\nSet whether the dialogs should vibrate the device when a selection is made. This defaults to `true`.\n\n### [All] `dismissOnPause(boolean dismissOnPause)`\n\nSet whether the picker dismisses itself when the parent Activity is paused or whether it recreates itself when the\nActivity is resumed.\n\n### [All] `setLocale(Locale locale)`\n\nAllows the client to set a custom locale that will be used when generating various strings in the pickers. By default\nthe current locale of the device will be used. Because the pickers will adapt to the Locale of the device by default you\nshould only have to use this in very rare circumstances.\n\n### [DatePickerDialog] `autoDismiss(boolean autoDismiss)`\n\nIf set to `true` will dismiss the picker when the user selects a date. This defaults to `false`.\n\n### [TimepickerDialog] `enableSeconds(boolean enableSconds)` and `enableMinutes(boolean enableMinutes)`\n\nAllows you to enable or disable a seconds and minutes picker on the `TimepickerDialog`. Enabling the seconds picker,\nimplies enabling the minutes picker. Disabling the minute picker will disable the seconds picker. The last applied\nsetting will be used. By default `enableSeconds = false` and `enableMinutes = true`.\n\n### [DatePickerDialog] `setTimeZone(Timezone timezone)` *deprecated*\n\nSets the `Timezone` used to represent time internally in the picker. Defaults to the current default Timezone of the\ndevice.\nThis method has been deprecated: you should use the `newInstance()` method which takes a Calendar set to the appropriate\nTimeZone.\n\n### [DatePickerDialog] `setDateRangeLimiter(DateRangeLimiter limiter)`\n\nProvide a custom implementation of DateRangeLimiter, giving you full control over which days are available for\nselection. This disables all of the other options that limit date selection.\n\n### `getOnTimeSetListener()` and `getOnDateSetListener()`\n\nGetters that allow the retrieval of a reference to the callbacks currently associated with the pickers\n\n### [DatePickerDialog] `setScrollOrientation(ScrollOrientation scrollOrientation)` and `getScrollOrientationi()`\n\nDetermines whether months scroll `Horizontal` or `Vertical`. Defaults to `Horizontal` for the v2 layout and `Vertical`\nfor the v1 layout\n\n## FAQ\n\n### Why does the `DatePickerDialog` return the selected month -1?\n\nIn the java `Calendar` class months use 0 based indexing: January is month 0, December is month 11. This convention is\nwidely used in the java world, for example the native Android DatePicker.\n\n### How do I use a different version of a support library in my app?\n\nThis library depends on some androidx support libraries. Because the jvm allows only one version of a fully namespaced\nclass to be loaded, you will run into issues if your app depends on a different version of a library than the one used\nin this app. Gradle is generally quite good at resolving version conflicts (by default it will retain the latest version\nof a library), but should you run into problems (eg because you disabled conflict resolution), you can disable loading a\nspecific library for MaterialDateTimePicker.\n\nUsing the following snippet in your apps `build.gradle` file you can exclude this library's transitive appcompat library\ndependency from being installed.\n\n```groovy\nimplementation ('com.wdullaer:materialdatetimepicker:4.2.3') {\n        exclude group: 'androidx.appcompat'\n        exclude group: 'androidx.recyclerview'\n}\n```\n\nMaterialDateTimepicker uses the following androidx libraries:\n\n```groovy\nimplementation 'androidx.appcompat:appcompat:1.0.2'\nimplementation 'androidx.recyclerview:recyclerview:1.0.0'\n```\n\nExcluding a dependency will work fine as long as the version your app depends on is recent enough and google doesn't\nrelease a version in the future that contains breaking changes. (If/When this happens I will try hard to document this).\nSee issue [#338](https://github.com/wdullaer/MaterialDateTimePicker/issues/338) for more information.\n\n### How do I turn this into a year and month picker?\n\nThis DatePickerDialog focuses on selecting dates, which means that it's central design element is the day picker. As\nthis calendar like view is the center of the design it makes no sense to try and disable it. As such selecting just\nyears and months, without a day, is not in scope for this library and will not be added.\n\n### How do I select multiple days?\n\nThe goal of this library is to implement the Material Design Date picker. This design is focused on picking exactly 1\ndate (with a large textual representation at the top). It would require quite a bit of redesigning to make it useful to\nselect multiple days. As such this feature is currently out of scope for this library and will not be added. If you\nhappen to make a library that implements this, based on this code or not, drop me a line and I'll happily link to it.\n\n### How do I use my custom logic to enable/disable dates?\n\n`DatePickerDialog` exposes some utility methods to enable / disable dates for common scenario's. If your needs are not\ncovered by these, you can supply a custom implementation of the `DateRangeLimiter` interface.\nBecause the `DateRangeLimiter` is preserved when the `Dialog` pauzes, your implementation must also\nimplement `Parcelable`.\n\n```java\nclass MyDateRangeLimiter implements DateRangeLimiter {\n  public MyDateRangeLimiter(Parcel in) {\n\n  }\n\n  @Override\n  public int getMinYear() {\n    return 1900;\n  }\n\n  @Override\n  public int getMaxYear() {\n    return 2100;\n  }\n\n  @Override\n  public Calendar getStartDate() {\n    Calendar output = Calendar.newInstance();\n    output.set(Calendar.YEAR, 1900);\n    output.set(Calendar.DAY_OF_MONTH, 1);\n    output.set(Calendar.MONTH, Calendar.JANUARY);\n    return output;\n  }\n\n  @Override\n  public Calendar getEndDate() {\n    Calendar output = Calendar.newInstance();\n    output.set(Calendar.YEAR, 2100);\n    output.set(Calendar.DAY_OF_MONTH, 1);\n    output.set(Calendar.MONTH, Calendar.JANUARY);\n    return output;\n  }\n\n  @Override\n  public boolean isOutOfRange(int year, int month, int day) {\n    return false;\n  }\n\n  @Override\n  public Calendar setToNearestDate(Calendar day) {\n      return day;\n  }\n\n  @Override\n  public void writeToParcel(Parcel out) {\n\n  }\n\n  @Override\n  public int describeContents() {\n    return 0;\n  }\n\n  public static final Parcelable.Creator\u003cMyDateRangeLimiter\u003e CREATOR\n        = new Parcelable.Creator\u003cMyDateRangeLimiter\u003e() {\n    public MyDateRangeLimiter createFromParcel(Parcel in) {\n        return new MyDateRangeLimiter(in);\n    }\n\n    public MyDateRangeLimiter[] newArray(int size) {\n        return new MyDateRangeLimiter[size];\n    }\n  };\n}\n```\n\nWhen you provide a custom `DateRangeLimiter` the built-in methods for setting the enabled / disabled dates will no\nlonger work. It will need to be completely handled by your implementation.\n\n## License\n\n    Copyright (c) 2015 Wouter Dullaert\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffulcrum6378%2Fmcdtp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffulcrum6378%2Fmcdtp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffulcrum6378%2Fmcdtp/lists"}