Rise Timesheet Monday Selector

Jamf Trust - ZTNA

Time Sheet: Visual Remediation

Company: TLC Solutions

Technical Overview

A lightweight content-script extension that forces the Rise timesheet date picker to the Monday of the current week so the full week is displayed instead of the current day.

The Problem

Rise’s Timesheet page (#/scheduling/timesheet) uses an Angular Material date picker (input[data-mat-calendar]).

By default the control initialises to today’s date. This causes the week view to start mid-week, forcing the user to manually navigate back to Monday on every visit.

Rise Defaul Extension

Goal

Automatically set the date-picker value to the Monday of the current ISO-style week as soon as the control appears, without relying on private Angular APIs or leaving long-lived observers running.

Implementation Summary (v1.2.0)

The script is a self-contained IIFE that runs as a content script.

Core date logic

 
JavaScript
function getMonday(date = new Date()) {
  // Normalise input → Date object
  // Use a fixed offset map so Sunday → previous Monday
  // 0 = Sunday … 6 = Saturday → offset to previous Monday  
  const diffMap = [5, -1, 0, 1, 2, 3, 4]; // corrected common mapping
  const day = date.getDay();
  date.setDate(date.getDate() - diffMap[day]);
  return date;
}

The resulting date is formatted as YYYY-MM-DD.

Setting the value (store-friendly path)

  1. Locate the input with document.querySelector('input[data-mat-calendar]').
  2. Focus the element.
  3. Assign the value via the native property (or the HTMLInputElement prototype setter as fallback).
  4. Dispatch the standard events Angular Material listens for:
 
JavaScript
['input', 'change', 'blur'].forEach(type => {
  input.dispatchEvent(new Event(type, { bubbles: true }));
});

No __ngContext__ or other private Angular structures are touched.

Lifecycle & observation

  • A hashchange listener re-arms the logic when the user navigates to #/scheduling/timesheet.
  • On the target page a short-lived MutationObserver (or a lightweight polling loop) waits for the date-picker input.
  • As soon as the input is found (or after a hard 12-second timeout) the observer is disconnected.
  • Success or timeout both trigger full cleanup so nothing continues running in the background.

This design keeps the extension’s footprint minimal and avoids the permanent document.body observer that previously raised review flags.

What Changed in v1.1.0

AreaPrevious behaviourCurrent behaviour
Angular accessUsed __ngContext__Pure DOM + events only
ObserverPermanent, subtree:trueShort-lived + 12 s safety timeout
SPA navigationBasic alreadyRan flagExplicit hashchange + cleanup
Value settingHeavy reliance on private APIsStandard property + event dispatch
Logging / residual workMore verboseMinimal + guaranteed cleanup
 

Privacy & Scope

  • Runs only on the Timesheet route.
  • No network requests, no storage, no messaging APIs.
  • Touches a single form control and then stops.

Information

Result

Opening or refreshing the Timesheet page now consistently shows the week that starts on Monday, removing the repetitive manual adjustment that was previously required.

Rise Monady Deafult - Browser Extension