tamble / jquery-ui-daterangepicker

A JQuery UI based date range picker.
MIT License
184 stars 108 forks source link

- Add translation (en/fr) #4

Open erodataM opened 9 years ago

erodataM commented 9 years ago
erodataM commented 9 years ago

For our project we needed a Google analytics like menu (possibility to select 2 ranges). It's a new option named : GAMenu (set it to true). screen

ghola commented 9 years ago

Hello Lionel, we are pleased to see you taking an interest in this daterangepicker implementation and we thank you for the contribution.

However, having studied your use case and the implementation, it seems that the current widget is rather limited. For example, what happens if someone else wants 3 ranges, or they want 2 ranges with a different menu than your current one?

It occurred to us that we should first open the daterangepicker a little bit more and allow third parties to implement custom plugins without affecting the base widget. This way we would allow for any number of menu implementations, any number of data formats and any number of ranges. Having done that, it would be easier to build variations of the widget and at the same time have better control over the core code.

We will leave the issue open for now so that others that require a GA menu can refer to your implementation. Once we make the above mentioned refactoring to our code we will let you know. Unfortunately we can't give a timeline/deadline on this.

erodataM commented 9 years ago

Thank you for answer. You're right, better idea to allow third parties to implement custom plugins. I used your work, so that's why I wanted to share mine =) (I'm french, sorry for my english) There is (at least) one issue with reposition function,due to the new menu, very easy to solve, I already did it and i'll push it tomorrow =)

Anselme commented 9 years ago

Hello erodataM,

if you want a french version of the datarangepicker, no need to re-write the code. You can use the option as follow :

 $(function() { 
      $("#form_dates").daterangepicker({
      initialText: 'Choisir un interval de dates...',
      applyButtonText: 'Appliquer',
      clearButtonText: 'Ré-initialiser',
      cancelButtonText: 'Annuler',
      datepickerOptions : {
        numberOfMonths: 2,
        dayNamesMin: [ "Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam" ],
        monthNames: [ "Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juli", "August", "September", "Oktober", "November", "December" ]
        },
      presetRanges: [
        {text: 'Depuis le début du mois', dateStart: function() { return moment().startOf('month') }, dateEnd: function() { return moment() } },
        {text: 'Le mois précédent', dateStart: function() { return moment().subtract('month', 1).startOf('month') }, dateEnd: function() { return moment().subtract('month', 1).endOf('month') } },
        {text: 'Depuis le début de l\'année', dateStart: function() { return moment().startOf('year') }, dateEnd: function() { return moment() } }
      ],
      onChange: function(){$('#form-date-range').submit();}
      });
  });