https://github.com/trychlos/pwix-date-input
A Blaze+bootstrap+jQuery component to enter a date
https://github.com/trychlos/pwix-date-input
Last synced: 6 months ago
JSON representation
A Blaze+bootstrap+jQuery component to enter a date
- Host: GitHub
- URL: https://github.com/trychlos/pwix-date-input
- Owner: trychlos
- Created: 2024-06-27T18:57:58.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2025-07-08T14:57:46.000Z (11 months ago)
- Last Synced: 2025-07-08T15:49:36.236Z (11 months ago)
- Language: JavaScript
- Size: 26.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog.md
Awesome Lists containing this project
README
# pwix:date-input
## What is it ?
A small package which provides an advanced component to enter a valid date:
- have an input field, with a standard (jQueryUI) date picker
- have a visual check with a real-time label on the side.
## Installation
This Meteor package is installable with the usual command:
```sh
meteor add pwix:date-input
```
## Usage
```html
{{> DateInput (parmsDate) }}
```
```js
import { DateInput } from 'meteor/pwix:date-input';
```
## Provides
### `DateInput`
The exported `DateInput` global object provides following items:
#### Functions
##### `DateInput.configure()`
See [below](#configuration).
### Blaze components
#### `DateInput`
A Blaze component which let you enter a date, or pick a date from the integrated jQuery calendar, and see the date in another format to be sure to not mix month and days.
Accepted data context is:
- `name`: an optional name, just to improve debug messages
- `id`: the input identifier to be set, defaulting to none
- `value`: an optional initial Date (if any)
- `defaultValue`: the default value when selecting a date, defaulting to date of day
- `inputFormat`: the desired input (strftime) format, defaulting to the configured one
- `placeholder`: the desired placeholder, defaulting to the configured one
- `helpFormat`: the desired help (strftime) format, defaulting to the configured one
- `withHelp`: whether we make use of help format, defaulting to the configured one
## Configuration
The package's behavior can be configured through a call to the `DateInput.configure()` method, with just a single javascript object argument, which itself should only contains the options you want override.
Known configuration options are:
- `inputFormat`
The `strftime` input format, defaulting to `%Y-%m-%d` which is a ISO date as in '2024-07-13'.
- `placeholder`
A string to be used as placeholder, should be consistent with the configured input format.
- `withHelp`
Whether an help string should be displayed when entering a date, defaulting to `false`.
- `helpFormat`
The `strftime` help format, defaulting to `%e %b %Y` which is a rather-well readable date as in '13 Jul. 2024'.
- `verbosity`
Define the expected verbosity level.
The accepted value can be any or-ed combination of following:
- `DateInput.C.Verbose.NONE`
Do not display any trace log to the console
- `DateInput.C.Verbose.CONFIGURE`
Trace `DateInput.configure()` calls and their result
Defaults to `DateInput.C.Verbose.CONFIGURE`.
Please note that `DateInput.configure()` method should be called in the same terms both in client and server sides.
Remind too that Meteor packages are instanciated at application level. They are so only configurable once, or, in other words, only one instance has to be or can be configured. Addtionnal calls to `DateInput.configure()` will just override the previous one. You have been warned: **only the application should configure a package**.
`DateInput.configure()` is a reactive data source.
## NPM peer dependencies
Starting with v 1.0.0, and in accordance with advices from [the Meteor Guide](https://guide.meteor.com/writing-atmosphere-packages.html#peer-npm-dependencies), we no more hardcode NPM dependencies in the `Npm.depends` clause of the `package.js`.
Instead we check npm versions of installed packages at runtime, on server startup, in development environment.
Dependencies as of v 1.2.0:
```js
'jquery-ui': '^1.13.3',
'lodash': '^4.17.0'
```
Each of these dependencies should be installed at application level:
```sh
meteor npm install --save
```
## Translations
None at the moment.
## Cookies and comparable technologies
None at the moment.
## Issues & help
In case of support or error, please report your issue request to our [Issues tracker](https://github.com/trychlos/pwix-date-input/issues).
---
P. Wieser
- Last updated on 2025, Jul. 8th