jtsage / jtsage-datebox

A multi-mode date and time picker for Bootstrap (3&4), jQueryMobile, Foundation, Bulma, FomanticUI, and UIKit (or others)
http://datebox.jtsage.dev/
Other
474 stars 166 forks source link

Extend calFormatter argument with curMonth and curYear #406

Closed slavap closed 7 years ago

slavap commented 7 years ago

http://dev.jtsage.com/DateBox/api/calFormatter/

Two additional fields could simplify calFormatter implementation logic, because there is a difference between dates of currently selected month and dates from previous and next months (e.g. "Non-Month Day Color").

jtsage commented 7 years ago

I'm not sure I follow totally. What info are you looking for inside that function, and as additional arguments, or in the special "date" object?

slavap commented 7 years ago

I mean in my calFormatter I have no enough info about input date. So curMonth and curYear should be in input param, so it will be:

{
    "Year" : 0, // Integer
    "Month" : 0-11, // Integer, Jan = 0 .. Dec = 11
    "Date" : 1-31, // Integer
    "ISO" : YYYY-MM-DD, // ISO Date Representation
    "Comp" : YYYYMMDD, // Little endian date compare representation
    "dateVisible" : bool // Selected date is on the screen
        "curMonth": 0-11, // Integer, currently displayed month
        "curYear": 0, // Integer, currently displayed year
}

You already have these values in the code, just additionally pass them within calFormatter input param.

P.S. Also in code you have very long lines, it's hard to read, why not format code to max 120 symbols in line? (looks like it caused by builder when constructing jtsage-datebox.js)

jtsage commented 7 years ago

Easy enough, added. New version drops in a few hours.