• Home
  • General
  • Localize NinjaForms THREE Pikaday Datepicker

Localize NinjaForms THREE Pikaday Datepicker

Since the release of THREE NinjaForms uses Pikaday as a new datepicker instead of jQueryUI, so I had to update my datepicker localization script.

I had no experience with BackboneJS, MomentJS, Marionette and all these new libraries used in NinjaForms 3 so it took me some time to find out how to customize the frontend.

Triggers: WordPress Hooks for JavaScript

NinjaForms offers some specific triggers so we can hook in our custom code as we would normally do in PHP.

When the datepicker initializes it fires an init  trigger in pikaday  channel. There’s an example in the NinjaForms developer docs.

Translate DatePicker and Date Format

To translate Pickaday as well as the return value we can use built in localization of moment.js:

 

2 thoughts on “Localize NinjaForms THREE Pikaday Datepicker”

  1. Hi
    For months I have tried to localize Ninja Forms pickaday to French. Your post has given me some hope, but… No such file as moment.js exists in latest NJ version. One single item is moment-with-locales.min.js with a lot of exotic languages, but no French. Is there anything to do (within my own meagre coding competence) to fix that ?
    Thanks in advance

    1. Hey Daniel,
      I think this was not clear enough in my article. You don’t need the file moment.js but the code is based on the library called “moment.js”
      You can copy the code above and use it in one of your (child-)theme’s JavaScript files (or any other custom JS file). You don’t need to modify any NinjaForms plugin files.
      best regards, Hannes

Leave a Reply

Your email address will not be published. Required fields are marked *