Skip to content

findWeekend

Returns the days of the weekend (0 = Sunday … 6 = Saturday) in a locale's region, per CLDR: "en-US" → [6, 0], "ar-SA" → [5, 6], "fa-IR" → [5]. Accepts the same forms as findWeekStart: "en-US", "en_US", script tags like "sr-Latn-RS", and 2-letter language codes, which resolve to their default region through findLocale ("ar" → "ar-SA" → [5, 6]). A locale whose region can't be found, or anything that isn't a string, has a Saturday and Sunday weekend.

Like findWeekStart, the region table is static so server-side and browser renders of the same chart agree.

Parameters

import {findWeekend} from "@d3plus/locales";
localerequiredstring

A locale code (e.g., "en-US", "ar_SA") or a 2-letter language code (e.g., "ar").