Sha256: 18a7fc3758f3cd760a39cffe703774c9c6726abdccecd41675cfc798cc4d7d8d

Contents?: true

Size: 939 Bytes

Versions: 3

Compression:

Stored size: 939 Bytes

Contents

class Lanes.Components.DateTime extends Lanes.React.Component

    mixins: [
        Lanes.Components.Form.FieldMixin
    ]
    fieldClassName: 'date-time'

    getDefaultProps: ->
        format: 'ddd, MMM Do YYYY, h:mm a'

    propTypes:
        unlabled: React.PropTypes.bool
        format:   React.PropTypes.string


    handleKeyDown: (ev) ->
        @props.onEnter() if ev.key is 'Enter'

    handleDateTimeChange: (val) ->
        @fieldMixinSetValue({target: {value: val}})


    renderDisplay: (props) ->
        <BS.FormControl.Static {...props}>
            {_.moment(@model[@props.name]).format(@props.format)}
        </BS.FormControl.Static>

    renderEdit: (props) ->
        props = _.extend({
            ref:       'control'
            value:     @fieldMixinGetValue()
            onChange:  @handleDateTimeChange
        }, @props)

        <Lanes.Vendor.ReactWidgets.DateTimePicker
            {...props}
        />

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lanes-0.5.6 client/lanes/components/shared/DateTime.cjsx
lanes-0.5.5 client/lanes/components/shared/DateTime.cjsx
lanes-0.5.0 client/lanes/components/shared/DateTime.cjsx