I'm using bootstrap-datepicker.js also with these changes, not sure it's as 
robust but works and I use it for multiple date formats such as this:

    Field('origination_date', 'date',
          widget=datepicker_widget(format='mm/yyyy', min_view_mode='months'
), requires=IS_DATE('%m/%Y')),  # example using just mm/yyyy

added widget
def datepicker_widget(**settings):

    def widget(field, value, **attributes):
        default = {'value': value}
        attributes = FormWidget._attributes(field, default, **attributes)
        attributes['_class'] = 'form-control date'

        # default format “mm/dd/yyyy”
        data_attributes = {}
        data_attributes['date-format'] = 'yyyy-mm-dd'
        for item in settings.iteritems():
            data_attributes['date-'+item[0].replace('_', '-')] = item[1]

        return INPUT(
            data=data_attributes,
            **attributes
        )

    return widget


added this to my layout (I actually place this in a .js file I then add to 
layout.html:
$('input.date').datepicker({
     todayBtn: "linked",
     autoclose: true,
     todayHighlight: true
});

I removed for web2py_ajax.html:
# response.files.insert(1,URL('static','css/calendar.css'))
# response.files.insert(2,URL('static','js/calendar.js'))


On Wednesday, July 6, 2016 at 6:59:02 PM UTC-4, Donald McClymont wrote:
>
> This now seems to be along the correct lines  - the issue I had was a 
> styling conflict with calendar.css file in web2py for the hour class being 
> set to 2em and my hack for now to fix was to append the following to the 
> std datetimepicker.css that can  be downloaded however not sure if there is 
> a better way.
>
> /* To revernt font 2em in web2py calendar component */
> .hour, .minute {font-size: 14px;}
>
>
>
>
> On Wednesday, July 6, 2016 at 1:17:59 PM UTC+1, Donald McClymont wrote:
>>
>> This is nice and a great improvement for dates.  I thought I could easily 
>> replicate for datetime by using this which seems to be a fork of the 
>> original to allow time input as well
>>
>>
>> http://www.malot.fr/bootstrap-datetimepicker/demo.php?utm_source=siteweb&utm_medium=demo&utm_campaign=Site%2BWeb
>>
>> https://github.com/smalot/bootstrap-datetimepicker
>>
>> however it seems to not be formatting the time selection correctly for 
>> some reason and may well need some adjustment to update with the script.  I 
>> will continue to look at getting working but if anyone else can provide 
>> some hints on how to do this then would be good to have both options 
>> available in some manner.
>>
>> Donald
>>
>>
>> On Tuesday, July 5, 2016 at 5:10:44 PM UTC+1, Ron Chatterjee wrote:
>>>
>>> I had my fair share of evaluation. Which looks better?
>>>
>>>
>>>
>>> On Monday, May 11, 2015 at 5:01:36 PM UTC-4, villas wrote:
>>>>
>>>> Thanks Leonel.
>>>>
>>>> BTW in your first post you said:   
>>>>     Field('birthdate', 'date', widget=bsdatepicker_widget) 
>>>>
>>>> It should be with brackets at the end:
>>>>     Field('birthdate', 'date', widget=bsdatepicker_widget()) 
>>>>
>>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to