Granular Date controls?

Here's a script column, that only shows the time when the file has been modified within the last three days.

function OnInit(initData) {
    initData.name = 'FuzzyDate';
    initData.version = '2022-02-17';
    initData.url = 'https://resource.dopus.com/t/granular-date-controls/40564';
    initData.default_enable = true;
    initData.min_version = '12.0';
}

function OnAddColumns(addColData) {
    var col = addColData.AddColumn();
    col.method = 'OnColumn';
    col.name = 'FuzzyDate';
    col.label = 'FuzzyDate';
    col.header = 'FuzzyDate';
    col.defwidth = 6;
    col.autorefresh = 1;
    col.autogroup = true;
}

function OnColumn(scriptColData) {
    var itemMod = scriptColData.item.modify;
    var oneDay = 24 * 3600 * 1000;
    var isYoung = DOpus.Create().Date() - itemMod < 3 * oneDay;
    scriptColData.value = itemMod.Format('d' + (isYoung ? 't' : ''));
    scriptColData.sort = itemMod * 1000 + itemMod.ms;
}

ColumnFuzzyDate.js.txt (847 Bytes)

See section "Script Add-Ins" in
https://resource.dopus.com/t/how-to-use-buttons-and-scripts-from-this-forum/3546

2 Likes