feat: Plan the next seven days from mobile #1179

Merged
rockachopa merged 5 commits from timmy/1177-plan-the-next-seven-days-from-mobile into main 2026-08-20 13:01:22 +00:00
2 changed files with 19 additions and 1 deletions
Showing only changes of commit 53c4340d76 - Show all commits

View File

@ -4,7 +4,13 @@ function createTodayRollover(options = {}) {
Intl.DateTimeFormat().resolvedOptions().timeZone || 'UTC');
function timeZone() {
return options.timeZone?.() || resolvedTimeZone();
const candidate = options.timeZone?.() || resolvedTimeZone();
try {
new Intl.DateTimeFormat('en', { timeZone: candidate }).format(now());
return candidate;
} catch (_error) {
return 'UTC';
}
}
function localDate() {

View File

@ -132,6 +132,18 @@ process.stdout.write(JSON.stringify({{date:rollover.localDate(),zone:rollover.ti
assert run_node(script) == {"date": "2026-11-01", "zone": "America/New_York"}
def test_invalid_runtime_timezone_falls_back_to_utc_without_breaking_planners():
script = f"""
const create = require({json.dumps(str(ROLLOVER))});
const rollover = create({{
now:()=>new Date('2026-08-20T23:30:00Z'),
resolvedTimeZone:()=> 'Etc/Unknown'
}});
process.stdout.write(JSON.stringify({{date:rollover.localDate(),zone:rollover.timeZone()}}));
"""
assert run_node(script) == {"date": "2026-08-20", "zone": "UTC"}
def test_rollover_is_one_durable_sync_operation_with_the_server_revision():
script = f"""
const createSync = require({json.dumps(str(SYNC))});