channelassignmentdates.js 1.17 KB
/*
 * ADOBE CONFIDENTIAL
 *
 * Copyright 2017 Adobe Systems Incorporated
 * All Rights Reserved.
 *
 * NOTICE:  All information contained herein is, and remains
 * the property of Adobe Systems Incorporated and its suppliers,
 * if any.  The intellectual and technical concepts contained
 * herein are proprietary to Adobe Systems Incorporated and its
 * suppliers and may be covered by U.S. and Foreign Patents,
 * patents in process, and are protected by trade secret or copyright law.
 * Dissemination of this information or reproduction of this material
 * is strictly forbidden unless prior written permission is obtained
 * from Adobe Systems Incorporated.
 */

(function(document, $) {
    'use strict';

    var CHANNEL_ASSIGNMENT_TYPE_SELECTOR = '.screens-ChannelAssignment-dates .coral-Form-field';

    $(document).on('focusout', CHANNEL_ASSIGNMENT_TYPE_SELECTOR, function(ev) {
        updateDateConstraints(ev.currentTarget);
    });

    function updateDateConstraints(el) {
        var $fields = $(CHANNEL_ASSIGNMENT_TYPE_SELECTOR);
        $fields.eq(0).attr('max', $fields.get(1).value);
        $fields.eq(1).attr('min', $fields.get(0).value);
    }

}(document, Granite.$));