Osy#betaRun it on Osyrin: osyrin.com

Kits · Data

Clock — the team's time zone and week

The app's clock — the time zone its days start in and the day its week starts, picked by staff from the app's declared zones on one settings page and read by every kit that counts in days.

Package
Osysharp.Clock
Install
use Osysharp.Clock@0;
Group
Data
Tests
6 in the kit’s own suite
Builds on
—
Used by
Notifications, Reports — build them, share them

One answer to "what day is it here?" for your whole app. Staff pick the time zone the team's days start in, and the day a week starts, from a list on one settings page. Everything that counts in days reads it: reports start "today", "this week" and "this month" at midnight there, and the daily digest goes out in the team's morning, in summer time as in winter.

The time zone, picked from the app's own list
The time zone, picked from the app's own list

osy

use Osysharp.Clock@0;

policy ManagesClock => IsLead;                                         // required unless your app defines IsAdmin (its default)
app.Clock = new ClockSetup { TimeZone = Zone.Of("Europe/Stockholm") };  // optional: the clock until staff pick one

var clock = TheClock();
var today = clock.DayOf(DateTime.UtcNow);          // the date on the team's wall
var since = clock.StartOf(clock.WeekOf(today));    // this week began here, at midnight
A typed time zonea Zone, picked from your app's declared zones, never typed. A name that is not a time zone cannot be saved
One settings pageSettings › Time and date: the zone and the first day of the week, saved with who changed it, drawn with no page code
Every kit on one clockOsysharp.Reports counts its periods and buckets on it, Osysharp.Notifications sends its digest by it
Days that follow summer timeDayOf, StartOf and WeekOf are the date, the midnight and the week start on the team's wall
Your zonesthe platform's set by default; declare zones { … } in your app to offer exactly the ones your teams work in
Read by everybodythe clock is not a secret, so a public page can say "open until 17:00" on it; only ManagesClock changes it
On a phone, in the dark
On a phone, in the dark

use Osysharp.Clock@0; needs Osysharp.Ui.

Get it

Add the kit to your app’s manifest:

osy

app MyApp {
  use Osysharp.Clock@0;
}

Then run osy lock: it downloads the release, verifies it by its content address and pins that version in osyrin.lock. osy kits Osysharp.Clock shows what the kit is for, from inside your app.

Reference: osy docs ui-clock-kit.