Code Monkey home page Code Monkey logo

angular-mighty-datepicker's Introduction

Angular based datepicker with mighty options

Documentation and demo

http://monterail.github.io/angular-mighty-datepicker/

Changelog:

0.1.4

  • fix problem with selecting 1 day in range picker

0.1.3

  • replaced deprecated momentjs function (#26) by @Jaspur

0.1.2

  • fix package.json format

0.1.1

0.1.0

  • added explicit dependency (#9) by @Jaspur
  • fixed missing week in January for leap year (#16) by @metrox

0.0.18

  • when two datepickers are used for range selection, additional parameters (range-from and range-to) allow to highlight selected time range

0.0.17

  • updating model in simple mode fixed (not tangling with model anymore)

0.0.16

  • cutsom templates fixed

0.0.15

  • when updating model in simple mode calendar moves to current month of new model

0.0.14

  • fix for custom markers in custom templates

0.0.13

  • after/before options moved to attributes (for easy databinding and updating)
  • added example with double datepicker for date range
  • added changelog in readme section

0.0.12

  • fixed datepicker for model that is not momentJS object

0.0.11

  • datepicker is updated when model changes (both single and multiple modes)

0.0.10

  • option for custom template

0.0.9

  • fixed marker styling for Firefox

0.0.8

  • watch and reindex markers when changed

0.0.7

  • simple markers for calendar days

0.0.6

  • fixed typos and readme
  • BEM classes fixed

0.0.5

  • filter and callback options

0.0.4

  • options object fix

0.0.3

  • changed classnames for elements

0.0.2

  • added before/after limits
  • multiple date select

0.0.1

  • initial release with simple datepicker functionality

angular-mighty-datepicker's People

Contributors

erbear avatar hodak avatar jandudulski avatar jaspur avatar metrox avatar nicieja avatar sirpeas avatar zip753 avatar zkusznir avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

angular-mighty-datepicker's Issues

Missing docs for 0.0.18

0.0.18

  • when two datepickers are used for range selection, additional parameters (range-from and range-to) allow to highlight selected time range

Docs are missing this function and how to use it. Probably also needed a higher version of Momentjs: 'moment.range' is undefined

Day of week order

I want to change the weekday order from Sunday to Saturday to Mon to Sunday.

Example,

Su Mo Tu We Th Fr Sa

to

Mo Tu We Th Fr Sa Su

So I changed the code in the _buildWeek method in the directive from

days = [0, 1, 2, 3, 4, 5, 6].map(function(d) {

to

days = [1, 2, 3, 4, 5, 6, 0].map(function(d) {

the days render correctly at the top but the actual day for each week on the Sunday shifts down, so displays as

Mo Tu We Th Fr Sa Su

30   31  1   2   3   4   29

6     7    8   9  10  11  5

...

You can see the Sunday has got the date of 29 and the 5th which is down a week.

Any ideas how I can fix this?

Many Thanks

Hide month navigation buttons

Maybe this is implemented, but I can't find it.

I'd like to hide the month navigation buttons so that the user is required to only select dates within the month that I display.

Support for I18N and L10N

Add support for

I18N: day of the week and month of the year in other languages than English
L10N: date format for country

External template

Hello !

Here is a way to make clean and separated template instead of writing them in variables ?

Thanks for your help !

Add class to dates in range

Hi,
Can you please add a class to dates which are placed between the start and the end date of a selected range?

Start double picker as blank range

I wasn't able to use double picker starting with a blank range, the problem is that if my data is { from: '', to: '' }, the picker will not let me select anything.

So I dug into the library and found if I can make the following change, it'll work. Basically, I just check is the model is empty.

          _withinLimits = function(day, month) {
            var withinLimits;
            withinLimits = true;
            if ($scope.model && $scope.model.isValid()) {
              if ($scope.before) {
                withinLimits && (withinLimits = day.isSameOrBefore($scope.before, 'day'));
              }
              if ($scope.after) {
                withinLimits && (withinLimits = day.isSameOrAfter($scope.after, 'day'));
              }
            }
            return withinLimits;
          };

package.json is malformed for use in npm

npm installation currently fails with the not-very-useful 'Arguments to path.resolve must be strings' error, as it expects the 'main' property to be a string, not an array.

Can be resolved by replacing
"main": [
"build/angular-mighty-datepicker.js",
"build/angular-mighty-datepicker.css"
]
with
"main": "build/angular-mighty-datepicker.js"

l10n?

Any plan to localize? In my local weeks do start from "Mo", not "Su"...

pasvaz.bindonce dependency?

Hi, I installed 0.1.4 using bower, and get an error saying that pasvaz.bindonce is required. In build/angular-mighty-datepicker.js, its required:

angular.module("mightyDatepicker", ["pasvaz.bindonce"]);

I thought this was removed? Any way to get around it?

Get Next month by Text

Hi, there is the function moveMonth(1) for going to the next month, but is there a way that I can get the month in text already for the next month in place of the > thats there by default?

@monterail-deploy @jandudulski

Month-Year

Is there any possibility to show only Month and year view of the calendar with all the attributes and options which are applicable for normal dd-mm-yyyy.

when ng-strict-di an error occurs and no date picker appears

It's related to using implicit DI on the directive. Making the change so that the following line:

angular.module("mightyDatepicker").directive("mightyDatepicker", function($compile) {
...
})

becomes:

angular.module("mightyDatepicker").directive("mightyDatepicker", ['$compile', function($compile) {
...
}])

fixes the error.

Add UMD support

Add UMD support to be used with AMD or CommonJs libraries like RequireJs.

Selecting a single date doesn't work for date ranges

I cannot select the same date in the "Double datepicker for date range" demo on http://monterail.github.io/angular-mighty-datepicker/.

Right in the beginning, I can select today's date on the left picker, but not on the right one. If I then select yesterday's date on the left picker, I can select today on the right and left. If I then click on tomorrow's date on the right picker, I can't select today on the right or tomorrow on the left. So in essence, it half-works in the start, but after some clicking around, it stops working on both sides.

I had it working with change before and after attributes, but that brakes the rangeFrom and rangeTo functionality.

It would be awesome if this could be fixed.

Bump moment-range dependency

It'd be nice to bump the dependency for moment-range to the latest version. It's usually not a bad idea to have the latest version of libs, and that includes moment-range.

In practice, our application depends on moment-range 2.x, so I'm running into a dependency conflict.

[BUG] Callback only called correctly when re-clicking it

See this video:
https://www.dropbox.com/s/hjtunfqeimbyfny/strange.mov?dl=0

As you can see the callback only is returned correctly when clicking for the second time..


    _callthis = function(day) {

        var _from = $scope.date_from.format('YYYY-MM-DD');
        var _to = $scope.date_to.format('YYYY-MM-DD');

        if(_to != 'Invalid date')
        {
            console.info(_from);
            console.info(_to);
        }
    }
    $scope.options_date_from = {callback: _callthis}; // start: moment().add('day', 2),
    $scope.options_date_to = {callback: _callthis};


    This HTML

    <mighty-datepicker ng-model="date_from" options="options_date_from" not-before="date_to"></mighty-datepicker>
    <mighty-datepicker ng-model="date_to" options="options_date_to" after="date_from"></mighty-datepicker>

Deselect date

There's an optional field in my form which the user may not want to fill in. I've added a button that assigns the model to undefined, but the angular-mighty-datepicker coerces undefined values to the current date using moment.js (https://github.com/monterail/angular-mighty-datepicker/blob/master/src/angular-mighty-datepicker.coffee#L221).

I've managed to avoid that by not using the ngModel option (passing a dummy value, since the directive doesn't work without a ngModel), and using the callback to set the selected value to my model. This works, but the date keeps selected, even though the model is empty, which is misleading for the user.

Is there an appropriate way to deselect the date in angular-mighty-datepicker?

Why can't i filter by iterating over an array?

Hi,

First of all, great and very clean directive! I ran into an issue when trying to filter out available dates in the directive. I tried the following:

var _filter_available_dates = function(day) {
      _.forEach($scope.event.occurrences, function(occurrence) {
        if(day.isSame(moment(occurrence.event_date))) {
          console.log('day', day.day(), moment(occurrence.event_date).day());
          return true;
         //return day.day();
        }
      });
    }

$scope.calendarOptions = {
      start: moment().add('month', -1),
      months: 1,
      mode: "multiple",
      callback: _selectedDate,
      filter: _filter_available_dates
    };

So the idea is that I would iterate over every day in my event's array, wrap it in a moment object and check if it's the same day as the day returned from the directive. If it is, i would return day.day().

This does not work and instead the entire calendar is greyed out even though I have matches.
Any ideas why?

Thank you!
screenshot 2015-10-30 23 09 02

Slow when select() on datepicker with markers.

The calendar is very slow when there are markers added ánd you wanna select some dates.
Pretty basis, but only tweaked the template. The select() is unchanged and this is causing slowness.

<mighty-datepicker markers="markers" ng-model="selected_dates" options="calendar_options">
</mighty-datepicker>

This options:

$scope.calendar_options = {
        callback: _callback_prices,
        months: 3,
        mode: 'multiple',
        start: moment().startOf('year'),
        end: moment().endOf('year'),
        before: moment().endOf('year'),
        filter: _filter,
        markerTemplate: null,
        template: "Tweaked template",
    };

With this Markers added:

angular.forEach(foobar, function(value, key) {
    $scope.markers.push({
        day: moment(value.date),
        marker: value.text,
    });
});

See video:
https://www.dropbox.com/s/hrq0ttxwd9sacv8/slow.mov?dl=0

Start date changes when selecting a date

I configure my calendar to display two months and hide the buttons using CSS as I want to limit the period (which doesn't seem to be an option I can pass?).

ctrl.datePickerOptions = {
    start: null,
    months: 2,
    mode: 'simple',
    filter: ctrl._filter,
    callback: ctrl._callback
};

The initial display works fine but when a date is selected in the second calendar, that second month becomes the first month. Is there a way to prevent this behaviour so that the starting month is retained when a date is selected?

Request: Different class for dates that are not in the month

Currently there are CSS classes for selectable dates, selected dates and disabled dates.

Currently dates that are not in the month use the 'disabled' class but I think having their own class is useful so that they can be styled independently of the disabled dates.

Extra class for active month for day--disabled

When you change the style of the mighty-picker-calendar__day--disabled class, it also gives that same style to the days that are not in the current month. But what I want is to have an extra class somewhere for the current month, so you can style the --disabled days different then from the not-current-month-days.

View is not updated when changing model

When trying to changed the ng-model from withing a controller, the view is not refreshed automatically, only when clicking the calendar.
I am trying to add new dates (moments) to a $scope.multi array, and expect to see the changed on the screen.
Any idea on how to fix this?

One time bindings

Hi, is it possible to drop 'pasvaz.bindonce' module in favor of ::single bindings in angular ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.