View | Details | Raw Unified | Return to bug 29963
Collapse All | Expand All

(-)a/cataloguing/value_builder/dateaccessioned.pl (-22 lines)
Lines 41-68 my $builder = sub { Link Here
41
        altInputClass: "input_marceditor flatpickr-input",
41
        altInputClass: "input_marceditor flatpickr-input",
42
        dateFormat: "Y-m-d"
42
        dateFormat: "Y-m-d"
43
    });
43
    });
44
    /* Set current date on page load */
45
    set_to_today($function_name.id);
46
});
44
});
47
48
function Focus$function_name(event) {
49
    set_to_today(event.data.id);
50
}
51
52
function Click$function_name(event) {
53
    event.preventDefault();
54
    set_to_today(event.data.id, 1);
55
}
56
57
function set_to_today( id, force ) {
58
    /* The force parameter is used in Click but not in Focus ! */
59
    if (! id) { alert(_("Bad id ") + id + _(" sent to set_to_today()")); return 0; }
60
    var elt = document.querySelector("#" + id);
61
    if ( elt.value == '' || force ) {
62
        const fp = document.querySelector("#" + id)._flatpickr;
63
        fp.setDate(new Date());
64
    }
65
}
66
</script>
45
</script>
67
END_OF_JS
46
END_OF_JS
68
    return $res;
47
    return $res;
69
- 

Return to bug 29963