Skip to content

Commit

Permalink
Merge branch 'v2.0-new'
Browse files Browse the repository at this point in the history
  • Loading branch information
mskocik committed Jul 18, 2022
2 parents 51218c2 + 9f84119 commit 779efba
Show file tree
Hide file tree
Showing 53 changed files with 5,995 additions and 1,675 deletions.
13 changes: 13 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.DS_Store
node_modules
/build
/.svelte-kit
/package
.env
.env.*
!.env.example

# Ignore files for PNPM, NPM and YARN
pnpm-lock.yaml
package-lock.json
yarn.lock
15 changes: 15 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module.exports = {
root: true,
extends: ['eslint:recommended'],
plugins: ['svelte3'],
overrides: [{ files: ['*.svelte'], processor: 'svelte3/svelte3' }],
parserOptions: {
sourceType: 'module',
ecmaVersion: 2020
},
env: {
browser: true,
es2017: true,
node: true
}
};
110 changes: 8 additions & 102 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,103 +1,9 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity
.vscode
# dotenv environment variables file
.DS_Store
node_modules
/build
/.svelte-kit
/package
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port
.env.*
!.env.example
.vscode
1 change: 0 additions & 1 deletion .npmignore

This file was deleted.

1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
engine-strict=true
21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

67 changes: 50 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ Simple date & time picker implemented in svelte.
Features:
- datepicker
- timepicker (with meridian support)
- various format
- various formatting options
- keyboard navigation
- includes `<input>` element
- custom element
- validator action for `<input>` using `svelte-use-forms` (optional)
- easily themable
- restriction by start and end date
- validator action for `<input>` using `svelte-use-forms` (optional)
- custom element

![screenshot](docs/screenshot.png)
![screenshot](https://raw.githubusercontent.com/mskocik/svelty-picker/main/docs/screenshot.png)

## ⚙️ Install

Expand Down Expand Up @@ -51,7 +52,6 @@ Try yourself in [REPL](https://svelte.dev/repl/98fd362aad6049f4b38606820baff0b0?
| mode | `string` | `auto` | restrict picker's mode. Possible values: `auto|date|datetime|time`. By default it try to guess the mode from `format` |
| format | `string` | `yyyy-mm-dd` | Format of entered date/time. See [format settings](#format-settings) for available options |
| weekStart | `number` | `1` | number in range `0-6` to select first day of the week. Sunday is `0` |
| visible | `bool` | `false` | Whether place picker inline after focus. By default picker is floating
| inputClasses | `string` | `` | input css class string |
| todayBtnClasses | `string` | `sdt-action-btn sdt-today-btn` | today button css classes |
| clearBtnClasses | `string` | `sdt-action-btn sdt-clear-btn` | clear button css classes |
Expand All @@ -77,24 +77,57 @@ config.todayBtn = false;
```
### Format settings

- `p` : meridian in lower case ('am' or 'pm') - according to locale file
- `P` : meridian in upper case ('AM' or 'PM') - according to locale file
- `s` : seconds without leading zeros
- `ss` : seconds, 2 digits with leading zeros
- `i` : minutes without leading zeros
- `ii` : minutes, 2 digits with leading zeros
- `h` : hour without leading zeros - 24-hour format
- `hh` : hour, 2 digits with leading zeros - 24-hour format
- `H` : hour without leading zeros - 12-hour format
- `HH` : hour, 2 digits with leading zeros - 12-hour format
Date format can be defined under `formatType` property. It has two options: `standard` and `php`, where
`standard` is the _default_.

#### `standard` format settings:

- `d` : day of the month without leading zeros
- `dd` : day of the month, 2 digits with leading zeros
- `D` : short textual representation of a weekday (i18n.daysShort)
- `DD` : long textual representation of a weekday (i18n.days)
- `S` : English ordinal suffix for the day of the month, (i18n.suffix)
- `m` : numeric representation of month without leading zeros
- `mm` : numeric representation of the month, 2 digits with leading zeros
- `M` : short textual representation of a month, three letters
- `MM` : full textual representation of a month, such as January or March
- `M` : short textual representation of a month, three letters (i18n.monthsShort)
- `MM` : full textual representation of a month, such as January or March (i18n.months)
- `yy` : two digit representation of a year
- `yyyy` : full numeric representation of a year, 4 digits
- `h` : hour without leading zeros - 24-hour format
- `hh` : hour, 2 digits with leading zeros - 24-hour format
- `H` : hour without leading zeros - 12-hour format
- `HH` : hour, 2 digits with leading zeros - 12-hour format
- `i` : minutes, 2 digits with leading zeros
- `ii` : alias for `i`
- `s` : seconds, 2 digits with leading zeros
- `ss` : alias for `s`
- `p` : meridian in lower case ('am' or 'pm') - according to locale file (i18n.meridiem)
- `P` : meridian in upper case ('AM' or 'PM') - according to locale file (i18n.meridiem)
- `t` : timestamp in milliseconds (although milliseconds are always 0). For timestamp in seconds use `php` format

#### `php` format settings:

- `d` : Day of the month, 2 digits with leading zeros 01 to 31
- `D` : A textual representation of a day, three letters Mon through Sun
- `j` : Day of the month without leading zeros 1 to 31
- `l` : A full textual representation of the day of the week Sunday through Saturday
- `N` : ISO 8601 numeric representation of the day of the week 1 (for Monday) through 7 (for Sunday)
- `S` : English ordinal suffix for the day of the month, 2 characters st, nd, rd or th. Works well with j
- `F` : A full textual representation of a month, such as January or March January through December
- `m` : Numeric representation of a month, with leading zeros 01 through 12
- `M` : A short textual representation of a month, three letters Jan through Dec
- `n` : Numeric representation of a month, without leading zeros 1 through 12
- `Y` : A full numeric representation of a year, at least 4 digits, with - for years BCE. Examples: -0055, 0787, 1999, 2003
- `y` : A two digit representation of a year Examples: 99 or 03
- `a` : Lowercase Ante meridiem and Post meridiem am or pm
- `A` : Uppercase Ante meridiem and Post meridiem AM or PM
- `g` : 12-hour format of an hour without leading zeros 1 through 12
- `G` : 24-hour format of an hour without leading zeros 0 through 23
- `h` : 12-hour format of an hour with leading zeros 01 through 12
- `H` : 24-hour format of an hour with leading zeros 00 through 23
- `i` : Minutes with leading zeros 00 to 59
- `s` : Seconds with leading zeros 00 through 59
- `U` : timestamp in seconds. For timestamp with miliseconds use `standard` format

### CSS variables

Expand Down
1 change: 0 additions & 1 deletion dist/svelty-picker-element-bundle.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/svelty-picker-element.js

This file was deleted.

6 changes: 0 additions & 6 deletions dist/svelty-picker.css

This file was deleted.

1 change: 0 additions & 1 deletion dist/svelty-picker.mjs

This file was deleted.

Empty file added docs/.nojekyll
Empty file.
1 change: 1 addition & 0 deletions docs/_app/immutable/assets/index-a9bc93c9.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 779efba

Please sign in to comment.