You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
1.6 KiB

1 year ago
# Tiny Components - datepicker
2 years ago
1 year ago
Datepicker for show Month and select a Single day.
Created with [Riot.js](https://riot.js.org)
Using Styles for UI from [Plain-UI](https://plain-ui.com), Date will be handle by [Day.js](https://day.js.org/en/) and Events with [Observable](https://github.com/riot/observable)
1 year ago
1 year ago
Source: [https://gitea.node001.net/tiny-components/datepicker](https://gitea.node001.net/tiny-components/datepicker)
Mirror: [https://github.com/node001-net/tiny-components-datepicker](https://github.com/node001-net/tiny-components-datepicker)
1 year ago
1 year ago
![demo](example/demo.gif)
1 year ago
## Installation
Setup this registry in your project .npmrc file:
```
@tiny-components:registry=https://gitea.node001.net/api/packages/tiny-components/npm/
```
Install with npm or yarn
```
1 year ago
npm i --save @tiny-components/datepicker
yarn add @tiny-components/datepicker
1 year ago
```
## Using
```
1 year ago
<tiny-datepicker></tiny-datepicker>
1 year ago
```
1 year ago
For starting weeks on Sunday,
```
<tiny-datepicker iso-week="0"></tiny-datepicker>
```
For setting date on start,
```
<tiny-datepicker date="2015-12-10"></tiny-datepicker>
```
## Events
If Date will "change",
```
import store from './store.js'
store.on('change', (data) => {
console.log(data.date.format('YYYY-MM-DD'))
})
```
1 year ago
Send Datepicker a new Date,
```
import store from './store.js'
store.trigger('update', {
date: '2012-10-20'
})
```
1 year ago
## i18n
1 year ago
Names of Days and Months will be used from Day.js, [here is a list of supported languages](https://github.com/iamkun/dayjs/tree/dev/src/locale).
Change language is only possible if you add change locale globally.
1 year ago
```
import de from 'dayjs/locale/de'
dayjs.locale('de')
```