Security News
Research
Supply Chain Attack on Rspack npm Packages Injects Cryptojacking Malware
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
ember-flatpickr
Advanced tools
This is an Ember addon that wraps the date picker flatpickr. It uses ember-cli-node-assets to pull in flatpickr from npm.
http://shipshapecode.github.io/ember-flatpickr/
ember install ember-flatpickr
{{ember-flatpickr
allowInput=false
altFormat='Y-m-d'
altInput=true
altInputClass='my-alt-input'
clickOpens=true
dateFormat='M/D/Y'
defaultDate=defaultDate
disable=datesToDisable
enable=datesToEnable
enableSeconds=false
enableTime=true
flatpickrRef=flatpickrRef
hourIncrement=1
inline=false
locale='ru'
maxDate=maxDate
minDate=minDate
minuteIncrement=5
mode='single'
nextArrow='>'
noCalendar=false
onChange=(action (mut dateValue))
onClose='doSomeStuffOnClose'
onOpen='doSomeStuffOnOpen'
onReady='doSomeStuffOnReady'
parseDate=false
placeholder='Choose a Date'
prevArrow='<'
static=false
timeFormat='H:i'
time_24hr=false
utc=false
value=(readonly dateValue)
wrap=false}}
*(onChange
is the only required option, but you can pass null if you do not care about it. All other options are displayed, but they have defaults and you only need to pass what you need)
Note: You should pass your value with the readonly
helper, and you should only update your value selected in the onChange
action. If you just want it to be set to the new dateObject
, you can use (action (mut dateValue))
like the example above.
Whenever a new date is selected, the action onChange
will be fired, and passed the new dateObject
and dateString
to that action. This allows you to pass whatever action you may want in to happen on change.
flatpickr provides several themes out of the box. You can specify a theme in your ember-cli-build.js
.
const app = new EmberApp(defaults, {
flatpickr: {
theme: 'material_blue'
}
});
flatpickr supports over 25 languages. You can specify the locales you want to support
in your ember-cli-build.js
, which will include the necessary locale js files.
const app = new EmberApp(defaults, {
flatpickr: {
locales: ['fr', 'de', 'ru', 'uk']
}
});
You can then use the locales you imported by specifying which you want in your template, like so:
{{ember-flatpickr
locale='ru'
onChange=(action (mut dateValue))
}}
maxDate
and minDate
are watched by observers, and will update the flatpickr instance whenever you change them. This allows you to do things like having two components, used as a range picker, and updating the minDate
and maxDate
to display valid date choices on each.
If you need to interact directly with the flatpickr instance you have created inside the component, you can pass in flatpickrRef=myFlatpickrRefName
, which would then be accesible in the controller or parent component. You can then do things like this.get('myFlatpickrRefName').close()
to close the datepicker, if you wanted to make a close button.
All options available to Flatpickr are available here.
Please see the flatpickr docs for a full list of options.
If there are features you would like to see implemented, or we have missed some flatpickr options, please open an issue and/or submit a PR!
FAQs
An Ember addon that wraps the date picker Flatpickr
The npm package ember-flatpickr receives a total of 7,870 weekly downloads. As such, ember-flatpickr popularity was classified as popular.
We found that ember-flatpickr demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.
Security News
Sonar’s acquisition of Tidelift highlights a growing industry shift toward sustainable open source funding, addressing maintainer burnout and critical software dependencies.