All Projects → Rafsanjani → datepickertimeline

Rafsanjani / datepickertimeline

Licence: MIT license
Linear date picker for Jetpack compose

Programming Languages

kotlin
9241 projects
shell
77523 projects

Projects that are alternatives of or similar to datepickertimeline

react-calendar
A no dependencies, lightweight and feature-rich ⚡ calendar component for react.
Stars: ✭ 68 (+58.14%)
Mutual labels:  datepicker, calendar-view
Primedatepicker
PrimeDatePicker is a tool that provides picking a single day, multiple days, and a range of days.
Stars: ✭ 292 (+579.07%)
Mutual labels:  datepicker, calendar-view
Calendarview
An Easy to Use Calendar for iOS (Swift 5.0)
Stars: ✭ 429 (+897.67%)
Mutual labels:  datepicker, calendar-view
Material Ui Pickers
Date & Time pickers, built with ❤️ for @material-ui/core
Stars: ✭ 2,291 (+5227.91%)
Mutual labels:  datepicker
React Datepicker2
react datepicker component.(include persian jalaali calendar)
Stars: ✭ 191 (+344.19%)
Mutual labels:  datepicker
Calendarview
A highly customizable calendar library for Android, powered by RecyclerView.
Stars: ✭ 2,862 (+6555.81%)
Mutual labels:  datepicker
nativescript-datetimepicker
Plugin with date and time picking fields
Stars: ✭ 26 (-39.53%)
Mutual labels:  datepicker
React Native Paper Dates
Smooth and fast cross platform Material Design date and time picker for React Native Paper
Stars: ✭ 173 (+302.33%)
Mutual labels:  datepicker
Adm Datetimepicker
Pure AngularJs dateTimePicker
Stars: ✭ 244 (+467.44%)
Mutual labels:  datepicker
Vue Bootstrap Datetimepicker
Vue.js component for eonasdan bootstrap datetimepicker
Stars: ✭ 221 (+413.95%)
Mutual labels:  datepicker
Datepicker
Get a date with JavaScript! A datepicker with no dependencies.
Stars: ✭ 212 (+393.02%)
Mutual labels:  datepicker
Hotel Datepicker
Date range picker for hotels
Stars: ✭ 202 (+369.77%)
Mutual labels:  datepicker
Flatpickr
lightweight, powerful javascript datetimepicker with no dependencies
Stars: ✭ 14,575 (+33795.35%)
Mutual labels:  datepicker
Vuetify Daterange Picker
The missing date range picker for Vuetify JS you have been looking for.
Stars: ✭ 192 (+346.51%)
Mutual labels:  datepicker
React Datepicker
An easily internationalizable, accessible, mobile-friendly datepicker library for the web, build with styled-components.
Stars: ✭ 252 (+486.05%)
Mutual labels:  datepicker
Android Pickerview
This is a picker view for android , support linkage effect, timepicker and optionspicker.(时间选择器、省市区三级联动)
Stars: ✭ 13,003 (+30139.53%)
Mutual labels:  datepicker
Didatepicker
Yet another datepicker for iOS
Stars: ✭ 242 (+462.79%)
Mutual labels:  datepicker
Persian Date Picker Dialog
Persian Date Picker Dialog for Android
Stars: ✭ 205 (+376.74%)
Mutual labels:  datepicker
Heyui
🎉UI Toolkit for Web, Vue2.0 http://www.heyui.top
Stars: ✭ 2,373 (+5418.6%)
Mutual labels:  datepicker
Vuejs Datepicker
A simple Vue.js datepicker component. Supports disabling of dates, inline mode, translations
Stars: ✭ 2,529 (+5781.4%)
Mutual labels:  datepicker

DatePickerTimeline Android CI

A linear Android date picker library written in Jetpack compose.
Inspired by https://pub.dev/packages/date_picker_timeline

Installation

Add the dependency to your build.gradle or build.gradle.kts file

repositories {
    maven { url 'https://jitpack.io' }
}

dependencies{
    implementation ("com.github.Rafsanjani:datepickertimeline:<latest_version>")
}

Usage

For a horizontal date picker with no customization

DatePickerTimeLine(
	modifier = Modifier,
	onDateSelected = {selectedDate: LocalDate->
		//do something with selected date
	}
) 

For a vertical date picker with no customization

import com.foreverrafs.datepicker.Orientation

DatePickerTimeLine(
	modifier = Modifier,
	orientation = Orientation.Vertical,
	onDateSelected = {selectedDate: LocalDate->
		//do something with selected date
	}
) 

You can pass an optional state to the picker and specify the initial selected date

DatePickerTimeLine(
	modifier = Modifier,
	state = rememberDatePickerState(initialDate = LocalDate.now()),
	onDateSelected = { selectedDate: LocalDate ->
		//do something with selected date
	}
) 

To customize the full list of properties

import com.foreverrafs.datepicker.Orientation

val today = LocalDate.now()
val datePickerState =  
    rememberDatePickerState(initialDate = LocalDate.now())
    
DatePickerTimeline(
  modifier = Modifier.wrapContentSize(),  
  onDateSelected = { selectedDate: LocalDate ->
		// do something with the selected date
  },  
  backgroundColor = Color.Yellow,  // the main background color
  state = datePickerState,  
  orientation = Orientation.Horizontal,  
  selectedBackgroundColor = Color.Green, // The background of the currently selected date  
  selectedTextColor = Color.White,  // Text color of currently selected date
  dateTextColor = Color.Black, //Text color of all dates  
  eventDates = listOf(  
        today.plusDays(1),  
        today.plusDays(3),  
        today.plusDays(5),  
        today.plusDays(8),  
  ),   
  todayLabel = {  
      Text(  
          modifier = Modifier.padding(10.dp),  
          text = "Today",  
          color = Color.White,  
          style = MaterialTheme.typography.h6  
      )
    },  
  pastDaysCount = 10,  // The number of previous dates to display, relative to the initial date. Defaults to 120
  eventIndicatorColor = Color.Brown // Indicator color for marked event dates.
)

Scrolling to different dates

You can store the DatePickerState object into a variable and use it to perform smooth scrolling to any date. This is very similar to how LazyListState works. If you try to scroll to an invalid date as constrained by the pastDaysCount property, you are scrolled to the first valid date in the calendar instead.

val today = LocalDate.now()
val datePickerState =  
    rememberDatePickerState(initialDate = LocalDate.now())
    
Column{
  DatePickerTimeline(
    state = datePickerState
  )
  
  Button(
    onClick = {
      // Scroll to Jan 01, 2022
      datePickerState.smoothScrollTodate(LocalDate.of(2022, 1, 1)
    }
  ){
    Text("Go to different date")
  }
}

Credits

License

MIT License

Copyright (c) 2021 Rafsanjani Aziz

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
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].