diff --git a/.github/.keep b/.github/.keep new file mode 100644 index 0000000..d65c3bf --- /dev/null +++ b/.github/.keep @@ -0,0 +1 @@ +codex placeholder \ No newline at end of file diff --git a/.github/workflows/browser-smoke.yml b/.github/workflows/browser-smoke.yml new file mode 100644 index 0000000..2678c4e --- /dev/null +++ b/.github/workflows/browser-smoke.yml @@ -0,0 +1,42 @@ +name: Browser Smoke + +on: + pull_request: + push: + branches: + - dev-claude + - main + workflow_dispatch: + +jobs: + smoke: + runs-on: ubuntu-latest + timeout-minutes: 15 + + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install Playwright test runner + run: npm install + + - name: Install Chromium + run: npx playwright install --with-deps chromium + + - name: Run browser smoke tests + run: npm run test:e2e + + - name: Upload Playwright report + if: always() + uses: actions/upload-artifact@v4 + with: + name: playwright-report + path: | + playwright-report + test-results + if-no-files-found: ignore diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..b704f0b --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,38 @@ +# AGENTS.md + +## Review Modes + +Before reviewing any browser-facing change, explicitly declare which mode you are using: + +- `Static review only`: code and diff inspection only. No runtime claims. +- `Browser automation verified`: browser tests or automation actually ran. +- `Deployed-site verified`: the live site was checked against the deployed commit/build. + +If browser/runtime verification is unavailable, say that before giving conclusions. + +## Frontend Gate + +Do not conclude `looks good`, `no issues`, or similar for stateful UI changes unless one of these is true: + +- browser automation passed for the affected flow +- the deployed site was manually verified +- the review explicitly says runtime is unverified + +## Mandatory Stateful UI Checks + +For startup, persistence, hydration, validation, and restore-path changes, review and/or test all of these: + +- fresh load with empty `localStorage` +- restore from valid saved state +- restore from malformed or partial saved state +- clear the origin after a valid saved session, then reload +- GitHub Pages hard refresh or private-window check when Pages is the release target + +## Evidence Format + +Every review summary should state: + +- scope reviewed +- branch or commit reviewed +- verification type used +- remaining unverified gap diff --git a/README.md b/README.md index 783e574..0d06167 100644 --- a/README.md +++ b/README.md @@ -14,16 +14,16 @@ Enter a date, time, and origin city — instantly see the equivalent local time ## Features -- **1,055 cities** across every IANA timezone -- **DST-aware** — handles daylight saving transitions correctly, including edge cases (clocks-skip-forward gaps, fall-back ambiguity) -- **Half & quarter-hour offsets** — India (UTC+5:30), Nepal (UTC+5:45), and all other non-whole-hour zones +- **1,055 cities** across every IANA timezone (1,039 unique city names; 16 appear in multiple countries) +- **DST-aware** — handles daylight saving transitions correctly via browser's built-in IANA database +- **Half & quarter-hour offsets** — India (UTC+5:30), Nepal (UTC+5:45), Iran (UTC+3:30), and all other non-whole-hour zones - **Fuzzy city search** — scored ranking so the best match always comes first; accents and diacritics normalised (type "Medellin" to find "Medellín") -- **City aliases** — historical and colloquial names supported: Bombay → Mumbai, Peking → Beijing, Saigon → Ho Chi Minh City, NYC, HK, KL, BKK, and more +- **44 city aliases** — historical and colloquial names: Bombay → Mumbai, Peking → Beijing, Saigon → Ho Chi Minh City, NYC, HK, KL, BKK, and more - **Multiple destinations** — add as many target cities as you need; first card is permanent, additional cards are removable -- **Copy result** — one click copies city, date, time, and timezone to clipboard -- **12h / 24h toggle** per destination card -- **Persistent state** — localStorage auto-saves your last session; reopening the app restores your cities and settings -- **Mobile-friendly** — stacked single-column layout on small screens, 3-column grid on desktop +- **12h / 24h toggle** per card, defaulting to 24h +- **Coherent color system** — origin card in blue, destination cards in burgundy red +- **Persistent state** — localStorage auto-saves your last session; reopening the app restores your cities, date, time, and format settings +- **Mobile-friendly** — stacked single-column layout on small screens, side-by-side grid on desktop - **Accessible** — full ARIA attributes, keyboard navigation in dropdowns, screen reader announcements on result updates --- @@ -35,7 +35,6 @@ Enter a date, time, and origin city — instantly see the equivalent local time 3. **Destination** — type the city you want to convert to and select it 4. **Read the result** — date, local time, and UTC offset appear instantly 5. **Add more** — click **+ Add destination** for additional cities -6. **Copy** — hit the **copy** button on any card to copy the result to clipboard --- @@ -44,13 +43,12 @@ Enter a date, time, and origin city — instantly see the equivalent local time | Detail | Value | |---|---| | Architecture | Single self-contained HTML file | -| Dependencies | None (zero npm, zero CDN at runtime) | +| Dependencies | No npm · Google Fonts loaded from CDN at runtime | | Fonts | Google Fonts (Playfair Display + DM Mono) | -| Data | 1,055 cities, ~50KB inline | +| Cities | 1,055 entries · 1,039 unique names · 44 aliases | | Algorithm | `Intl.DateTimeFormat` + iterative `wallToUTC` for DST correctness | | Storage | `localStorage` key `tc-v2` | | Browser support | Any modern browser (Chrome, Firefox, Safari, Edge) | -| File size | ~80KB | --- @@ -64,7 +62,7 @@ start index.html # Windows xdg-open index.html # Linux ``` -Or serve it with any static server: +Or serve with any static server: ```bash npx serve . @@ -81,20 +79,6 @@ python3 -m http.server 8080 --- -## Test suite - -A separate `test-suite.html` file covers 86 automated tests across: -- Algorithm correctness (offsets, half-hour zones, 12h/24h) -- DST transitions (spring forward, fall back, no-DST zones) -- Date boundaries (year rollover, leap years, midnight edge cases) -- XSS and injection resistance -- Malicious / out-of-range inputs -- Regression cases - -Open `test-suite.html` in a browser to run all tests. - ---- - ## License MIT — do whatever you want with it. diff --git a/index.html b/index.html index e736dcb..ce6633c 100644 --- a/index.html +++ b/index.html @@ -2,6 +2,7 @@
+