Compare commits

...

2 Commits

Author SHA1 Message Date
shamoon
2fd1e90470 Tweak: improve 2-digit year parsing 2025-12-17 21:15:27 -08:00
shamoon
7c8db78a62 Chore: use the MS playwright image for e2e testing in CI (#11607) 2025-12-16 08:46:12 -08:00
2 changed files with 20 additions and 17 deletions

View File

@@ -275,8 +275,12 @@ jobs:
tests-frontend-e2e:
name: "Frontend E2E Tests (Node ${{ matrix.node-version }} - ${{ matrix.shard-index }}/${{ matrix.shard-count }})"
runs-on: ubuntu-24.04
container: mcr.microsoft.com/playwright:v1.57.0-noble
needs:
- install-frontend-dependencies
env:
PLAYWRIGHT_BROWSERS_PATH: /ms-playwright
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
strategy:
fail-fast: false
matrix:
@@ -305,19 +309,8 @@ jobs:
key: ${{ runner.os }}-frontenddeps-${{ hashFiles('src-ui/pnpm-lock.yaml') }}
- name: Re-link Angular cli
run: cd src-ui && pnpm link @angular/cli
- name: Cache Playwright browsers
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ hashFiles('src-ui/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-playwright-
- name: Install Playwright system dependencies
run: npx playwright install-deps
- name: Install dependencies
run: cd src-ui && pnpm install --no-frozen-lockfile
- name: Install Playwright
run: cd src-ui && pnpm exec playwright install
- name: Run Playwright e2e tests
run: cd src-ui && pnpm exec playwright test --shard ${{ matrix.shard-index }}/${{ matrix.shard-count }}
frontend-bundle-analysis:

View File

@@ -106,15 +106,25 @@ export class LocalizedDateParserFormatter extends NgbDateParserFormatter {
value = this.preformatDateInput(value)
let match = this.getDateParseRegex().exec(value)
if (match) {
const currentYear = new Date().getFullYear()
const currentCentury = currentYear - (currentYear % 100)
let year = +match.groups.year
if (year < 100) {
let fourDigitYear = currentCentury + year
// Mimic python-dateutil: keep result within -50/+49 years of current year
if (fourDigitYear > currentYear + 49) {
fourDigitYear -= 100
} else if (fourDigitYear <= currentYear - 50) {
fourDigitYear += 100
}
year = fourDigitYear
}
let dateStruct = {
day: +match.groups.day,
month: +match.groups.month,
year: +match.groups.year,
}
if (dateStruct.year <= new Date().getFullYear() - 2000) {
dateStruct.year += 2000
} else if (dateStruct.year < 100) {
dateStruct.year += 1900
year,
}
return dateStruct
} else {