Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/horprogs/just-validate-plugin-date
https://github.com/horprogs/just-validate-plugin-date
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/horprogs/just-validate-plugin-date
- Owner: horprogs
- License: other
- Created: 2021-12-29T12:33:56.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-11-27T17:59:31.000Z (about 2 years ago)
- Last Synced: 2024-11-02T00:47:51.289Z (2 months ago)
- Language: TypeScript
- Size: 178 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# JustValidate plugin date
[![codecov](https://codecov.io/gh/horprogs/just-validate-plugin-date/branch/main/graph/badge.svg?token=B98J47L4YI)](https://codecov.io/gh/horprogs/just-validate-plugin-date)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/f730fb9086964a74b2b01e56c3d8efe9)](https://www.codacy.com/gh/horprogs/just-validate-plugin-date/dashboard?utm_source=github.com&utm_medium=referral&utm_content=horprogs/just-validate-plugin-date&utm_campaign=Badge_Grade)
[![Known Vulnerabilities](https://snyk.io/test/github/horprogs/Just-validate-plugin-date/badge.svg)](https://snyk.io/test/github/horprogs/Just-validate-plugin-date)
[![Release workflow](https://github.com/horprogs/Just-validate-plugin-date/workflows/Test%20and%20Release/badge.svg)](https://github.com/horprogs/Just-validate-plugin-date/actions)Date validation plugin for JustValidate library
## Installation
### npm
```shell
npm install just-validate-plugin-date --save
```### yarn
```shell
yarn add just-validate-plugin-date
```And then use it as an imported module:
```js
import JustValidatePluginDate from 'just-validate-plugin-date';
```Or if you don't use module bundlers, just include JustValidatePluginDate script on your page from CDN and call it as `window.JustValidatePluginDate`:
```html
```
## Usage
This plugin is supposed to use together with JustValidate library. It takes 1 argument: function which returns the validation config.
Check more details and examples here: https://github.com/horprogs/Just-validate
```js
JustValidatePluginDate((fields) => ({
required: true,
format: 'dd/MM/yyyy',
isAfter: fields['#date_after'].elem.value,
isBefore: fields['#date_before'].elem.value,
}));
``````js
import JustValidatePluginDate from 'just-validate-plugin-date';validator.addField('#date', [
{
plugin: JustValidatePluginDate((fields) => ({
format: 'dd/MM/yyyy',
isAfter: '',
})),
},
]);
```## Validators
- isAfter
- isBefore
- isBeforeOrEqual
- isAfterOrEqual
- isEqual