All Projects → bkhezry → PersianDateRangePicker

bkhezry / PersianDateRangePicker

Licence: other
Select range of date and time in the Persian

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to PersianDateRangePicker

react-calendar-datetime-picker
A simple and fast date and time picker component for React
Stars: ✭ 58 (+41.46%)
Mutual labels:  datetime, datepicker, persian, persian-calendar
mds-angular-datetime-picker-package
Angular 2+ And Bootstrap 4+ DateTimePicker
Stars: ✭ 18 (-56.1%)
Mutual labels:  datetime, persian, persian-calendar
imrc-datetime-picker
(Improved) React component datetime picker by momentjs 📆
Stars: ✭ 21 (-48.78%)
Mutual labels:  datetime, datepicker
MoalemYar
A personal project for class management, using various technologies like WPF, Entityframwork, CodeFirst, Sqlite, Migration and more
Stars: ✭ 53 (+29.27%)
Mutual labels:  persian, persian-calendar
svelty-picker
Simple date & time picker in svelte
Stars: ✭ 38 (-7.32%)
Mutual labels:  datetime, datepicker
Pg Calendar
📆 beautiful and eidetic date picker
Stars: ✭ 109 (+165.85%)
Mutual labels:  datetime, datepicker
Horizontalpicker
DatePicker horizontal con selección smooth por día para Android.
Stars: ✭ 116 (+182.93%)
Mutual labels:  datetime, datepicker
vue2-persian-datepicker
A vue component that provides datepicker for persian developers
Stars: ✭ 100 (+143.9%)
Mutual labels:  datepicker, persian-calendar
Md.persiandatetime
A C# library to use PersianCalendar as easy as DateTime
Stars: ✭ 68 (+65.85%)
Mutual labels:  datetime, persian
shamsi date
A Flutter and Dart package for using Jalali (Shamsi, Solar, Persian or Jalaali) calendar. You can convert, format and manipulate Jalali and Gregorian (Miladi) date and times.
Stars: ✭ 59 (+43.9%)
Mutual labels:  datetime, persian
flutter date picker timeline
Gregorian and Jalali customizable date picker as a horizontal timeline
Stars: ✭ 29 (-29.27%)
Mutual labels:  datepicker, persian-calendar
Blazor.PersianDatePicker
A free JavaScript Jalali (Persian) and Gregorian (Miladi) dual datepicker library for Blazor applications
Stars: ✭ 40 (-2.44%)
Mutual labels:  datepicker, persian-calendar
Angular Bootstrap Datetimepicker
Native Angular date/time picker component styled by Twitter Bootstrap
Stars: ✭ 1,289 (+3043.9%)
Mutual labels:  datetime, datepicker
Rc Datetime Picker
React component for datetime picker by Moment.js
Stars: ✭ 85 (+107.32%)
Mutual labels:  datetime, datepicker
Flatpickr
lightweight, powerful javascript datetimepicker with no dependencies
Stars: ✭ 14,575 (+35448.78%)
Mutual labels:  datetime, datepicker
Circularpicker
CircularPicker is helpful for creating a controller aimed to manage any calculated parameter.
Stars: ✭ 73 (+78.05%)
Mutual labels:  datetime, datepicker
Laydate
layDate(日期与时间组件) 是 layui 独立维护的三大组件之一
Stars: ✭ 1,066 (+2500%)
Mutual labels:  datetime, datepicker
Persiantools
Jalali date and datetime with other tools
Stars: ✭ 57 (+39.02%)
Mutual labels:  datetime, persian
persiantools
Jalali date and datetime with other tools
Stars: ✭ 101 (+146.34%)
Mutual labels:  datetime, persian
vue3-date-time-picker
Datepicker component for Vue 3
Stars: ✭ 157 (+282.93%)
Mutual labels:  datetime, datepicker

PersianDateRangePicker

Build Status

Select range of dates and times in the Persian Calender

Project Setup and Dependencies

  • JDK 8
  • Android SDK Build tools 28.0.3
  • Supports API Level +17
  • AppCompat & Design libraries androidx v:1.0.0

A quick overview

  • compatible with API Level +17
  • RTL support
  • Custom Font support

Preview

Demo

You can download the latest demo APK from here: https://github.com/bkhezry/PersianDateRangePicker/blob/master/assets/PersianDateRangePicker.apk

Screenshots

Setup

1. Provide the gradle dependency

Add it in your root build.gradle at the end of repositories:

allprojects {
	repositories {
		...
		maven { url "https://jitpack.io" }
	}
}

Add the dependency:

dependencies {
	implementation 'com.github.bkhezry:PersianDateRangePicker:1.2.6'
}

Using the Pickers

  1. Implement an PersianDatePickerDialog.OnDateSetListener or PersianTimePickerDialog.OnTimeSetListener
  2. Create a PersianDatePickerDialog using the supplied factory

Implement an OnDateSetListener

In order to receive the date set in the picker, you will need to implement the OnDateSetListener interfaces. Typically this will be the Activity or Fragment that creates the Pickers.

or

Implement an OnTimeSetListener

In order to receive the time set in the picker, you will need to implement the OnTimeSetListener interfaces. Typically this will be the Activity or Fragment that creates the Pickers.

//new onDateSet
@Override
public void onDateSet(DatePickerDialog view, int year, int monthOfYear, int dayOfMonth,int yearEnd, int monthOfYearEnd, int dayOfMonthEnd) {
String monthString = String.valueOf(monthOfYear + 1);
    if (monthOfYear < 9) {
      monthString = "0" + monthString;
    }
    String dayString = String.valueOf(dayOfMonth);
    if (dayOfMonth < 10) {
      dayString = "0" + dayString;
    }
    String monthStringEnd = String.valueOf(monthOfYearEnd + 1);
    if (monthOfYearEnd < 9) {
      monthStringEnd = "0" + monthStringEnd;
    }
    String dayStringEnd = String.valueOf(dayOfMonthEnd);
    if (dayOfMonthEnd < 10) {
      dayStringEnd = "0" + dayStringEnd;
    }
    fromDate.setText(String.format("%s/%s/%s", LanguageUtils.getPersianNumbers(String.valueOf(year)), LanguageUtils.getPersianNumbers(monthString), LanguageUtils.getPersianNumbers(dayString)));
    toDate.setText(String.format("%s/%s/%s", LanguageUtils.getPersianNumbers(String.valueOf(yearEnd)), LanguageUtils.getPersianNumbers(monthStringEnd), LanguageUtils.getPersianNumbers(dayStringEnd)));
}

@Override
public void onTimeSet(PersianRadialPickerLayout view, int year, int monthOfYear, int dayOfMonth,int yearEnd, int monthOfYearEnd, int dayOfMonthEnd) {
      String hourString = String.valueOf(hourOfDay);
    if (hourOfDay < 10) {
      hourString = "0" + hourString;
    }
    String minuteString = String.valueOf(minute);
    if (minute < 10) {
      minuteString = "0" + minuteString;
    }
    String hourStringEnd = String.valueOf(hourOfDayEnd);
    if (hourOfDayEnd < 10) {
      hourStringEnd = "0" + hourStringEnd;
    }
    String minuteStringEnd = String.valueOf(minuteEnd);
    if (minuteEnd < 10) {
      minuteStringEnd = "0" + minuteStringEnd;
    }
    fromTime.setText(String.format("%s:%s", LanguageUtils.getPersianNumbers(hourString), LanguageUtils.getPersianNumbers(minuteString)));
    toTime.setText(String.format("%s:%s", LanguageUtils.getPersianNumbers(hourStringEnd), LanguageUtils.getPersianNumbers(minuteStringEnd)));

}

Create a PersianDatePickerDialog` using the supplied factory

You will need to create a new instance of PersianDatePickerDialog using the static newInstance() method, supplying proper default values and a callback. Once the dialogs are configured, you can call show().

  PersianDate now = new PersianDate();
  PersianDatePickerDialog dpd = PersianDatePickerDialog.newInstance(
    MainActivity.this,
    now.getPersianYear(),
    now.getPersianMonth(),
    now.getPersianDay()
  );
  dpd.setTypeface(fontName);
  dpd.show(getFragmentManager(), "PersianDatePickerDialog");

Create a PersianTimePickerDialog` using the supplied factory

You will need to create a new instance of PersianTimePickerDialog using the static newInstance() method, supplying proper default values and a callback. Once the dialogs are configured, you can call show().

   PersianDate now = new PersianDate();
   PersianTimePickerDialog tpd = PersianTimePickerDialog.newInstance(
     MainActivity.this,
     now.get(PersianDate.HOUR_OF_DAY),
     now.get(PersianDate.MINUTE),
     true
   );
   tpd.setTypeface(fontName);
   tpd.setOnCancelListener(new DialogInterface.OnCancelListener() {
     @Override
     public void onCancel(DialogInterface dialogInterface) {
       Log.d("TimePicker", "Dialog was cancelled");
     }
   });
   tpd.show(getFragmentManager(), "PersianTimePickerDialog");

Credits

  • PersianMaterialDateTimePicker- GitHub
  • MaterialDateRangePicker- GitHub

Developed By

License

Copyright 2018 Behrouz Khezry

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].