Moneybird - Copy start date to end date on time entry edit page

Copy start date to end date on time entry edit page

目前为 2023-04-06 提交的版本。查看 最新版本

// ==UserScript==
// @name         Moneybird - Copy start date to end date on time entry edit page
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  Copy start date to end date on time entry edit page
// @author       pindab0ter
// @match        https://moneybird.com/*
// @icon         https://assets2.sorryapp.com/brand_favicons/files/000/004/522/original/favicon-32.png
// @grant        none
// @license      MIT
// @run-at       document-start
// ==/UserScript==

(function () {
    'use strict';

    // Check if we’re on the time entry edit page
    if (!window.location.pathname.match(/time_entries\/\d+\/edit/)) {
        return;
    }

    document.addEventListener('DOMContentLoaded', function () {
        const startedAtDateInput = document.getElementById('time_entry_started_at')
            ?.parentElement?.parentElement?.getElementsByClassName('date-picker__input')?.item(0);
        const endedAtDateInput = document.getElementById('time_entry_ended_at')
            ?.parentElement?.parentElement?.getElementsByClassName('date-picker__input')?.item(0);

        if (startedAtDateInput && endedAtDateInput?.value === "") {
            endedAtDateInput.value = startedAtDateInput.value;
        }
    });
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址