Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to hide current date information when using TimePicker? #63

Open
bartoszhernas opened this issue Feb 15, 2015 · 3 comments
Open

How to hide current date information when using TimePicker? #63

bartoszhernas opened this issue Feb 15, 2015 · 3 comments

Comments

@bartoszhernas
Copy link

I want to have only time picker, without date, but when using TimePicker, you can see date on the top

screenshot 2015-02-15 16 47 04

Is there any way to hide it?

@BobBowles
Copy link

I had the same problem, I don't live 2 centuries ago!

This is a workaround that works for me. It blanks the header of the popout. At least you don't see a ridiculous date! In your css file:

.datetimepicker th {
    visibility: hidden !important;
}

It leaves you with an empty header, probably with a bit more tweaking you can work round that in the css too.

@symbiosdotwiki
Copy link

Also having this issue. I'm not seeing how to differentiate the Date and Time pickers from the javascript to be able to avoid this.

@symbiosdotwiki
Copy link

After some digging,

widgets.py should be updated like so:

quoted_options = set([
    'format',
    'startDate',
    'endDate',
    'startView',
    'minView',
    'maxView',
    'todayBtn',
    'language',
    'pickerPosition',
    'viewSelect',
    'initialDate',
    'weekStart',
    'minuteStep'
    'daysOfWeekDisabled',
    'formatViewType'
    ])

and

class TimeWidget(PickerWidgetMixin, TimeInput):
    """
    TimeWidget is the corresponding widget for Time field, it renders only the time section of
    datetime picker.
    """

    format_name = 'TIME_INPUT_FORMATS'
    glyphicon = 'glyphicon-time'

    def __init__(self, attrs=None, options=None, usel10n=None, bootstrap_version=None):

        if options is None:
            options = {}

        # Set the default options to show only the timepicker object
        options['startView'] = options.get('startView', 1)
        options['minView'] = options.get('minView', 0)
        options['maxView'] = options.get('maxView', 1)
        options['format'] = options.get('format', 'hh:ii')
        options['formatViewType'] = 'time'

        super(TimeWidget, self).__init__(attrs, options, usel10n, bootstrap_version)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants