mirror of
https://github.com/aculix/negotium.git
synced 2026-09-11 07:28:17 +00:00
fix: say what carry-over did, and stop the day control being a riddle
Two pieces of copy that were making the app harder to read than it needs to be. Carry-over happened in total silence. Open the app after a weekend and unfamiliar tasks were sitting in Today with nothing explaining where they came from, which reads as a bug rather than the feature it is. A line now says how many were brought forward, on the day it happened, and it can be dismissed. The day control was a single button labelled with the day you were already on, which then took you somewhere else. Clicking it was the only way to find out what it did, and the date underneath already said where you were. It is two options now with the current one marked, so the control states both where you are and what the alternative is without being touched. Also drops labelFor from dates.js along with its tests. It existed to label that one button and nothing uses it now.
This commit is contained in:
@@ -28,12 +28,6 @@ export function isKey(value) {
|
||||
return KEY_PATTERN.test(value)
|
||||
}
|
||||
|
||||
export function labelFor(dateKey, todayKey) {
|
||||
if (dateKey === todayKey) return 'Today'
|
||||
if (dateKey === toKey(addDays(fromKey(todayKey), 1))) return 'Tomorrow'
|
||||
return fromKey(dateKey).toLocaleDateString('en-US', { month: 'short', day: 'numeric' })
|
||||
}
|
||||
|
||||
export function formatLong(dateKey) {
|
||||
return fromKey(dateKey).toLocaleDateString('en-US', {
|
||||
weekday: 'long',
|
||||
|
||||
+1
-23
@@ -1,5 +1,5 @@
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import { toKey, fromKey, addDays, isKey, labelFor, formatLong } from './dates.js'
|
||||
import { toKey, fromKey, addDays, isKey, formatLong } from './dates.js'
|
||||
|
||||
describe('toKey', () => {
|
||||
it('formats a date as local YYYY-MM-DD', () => {
|
||||
@@ -60,28 +60,6 @@ describe('isKey', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('labelFor', () => {
|
||||
it('labels today', () => {
|
||||
expect(labelFor('2026-08-15', '2026-08-15')).toBe('Today')
|
||||
})
|
||||
|
||||
it('labels tomorrow', () => {
|
||||
expect(labelFor('2026-08-16', '2026-08-15')).toBe('Tomorrow')
|
||||
})
|
||||
|
||||
it('labels tomorrow across a month boundary', () => {
|
||||
expect(labelFor('2026-09-01', '2026-08-31')).toBe('Tomorrow')
|
||||
})
|
||||
|
||||
it('labels tomorrow across a year boundary', () => {
|
||||
expect(labelFor('2027-01-01', '2026-12-31')).toBe('Tomorrow')
|
||||
})
|
||||
|
||||
it('falls back to a short date for other days', () => {
|
||||
expect(labelFor('2026-08-20', '2026-08-15')).toBe('Aug 20')
|
||||
})
|
||||
})
|
||||
|
||||
describe('formatLong', () => {
|
||||
it('renders the long-form date used in the header', () => {
|
||||
expect(formatLong('2026-08-15')).toBe('Saturday, August 15, 2026')
|
||||
|
||||
Reference in New Issue
Block a user