Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const month = ChronoField.MONTH_OF_YEAR.checkValidIntValue(fieldValues.get(ChronoField.MONTH_OF_YEAR));
date = LocalDate.of(year, month, 8); // TODO: chrono.date(year, month, 8);
const dateDow = this._localizedDayOfWeek(date, sow);
const wom = this._range.checkValidIntValue(value, this);
const weeks = wom - this._localizedWeekOfMonth(date, dateDow);
days = weeks * 7 + (dow - dateDow);
}
date = date.plus(days, ChronoUnit.DAYS);
if (resolverStyle === ResolverStyle.STRICT) {
if (date.getLong(ChronoField.MONTH_OF_YEAR) !== fieldValues.get(ChronoField.MONTH_OF_YEAR)) {
throw new DateTimeException('Strict mode rejected date parsed to a different month');
}
}
fieldValues.remove(this);
fieldValues.remove(ChronoField.YEAR);
fieldValues.remove(ChronoField.MONTH_OF_YEAR);
fieldValues.remove(ChronoField.DAY_OF_WEEK);
return date;
} else if (this._rangeUnit === ChronoUnit.YEARS) { // week-of-year
const value = fieldValues.remove(this);
let date = LocalDate.of(year, 1, 1); // TODO: chrono.date(year, 1, 1);
let days;
if (resolverStyle === ResolverStyle.LENIENT) {
const dateDow = this._localizedDayOfWeek(date, sow);
const weeks = value - this._localizedWeekOfYear(date, dateDow);
days = weeks * 7 + (dow - dateDow);
} else {
const dateDow = this._localizedDayOfWeek(date, sow);
const woy = this._range.checkValidIntValue(value, this);
const weeks = woy - this._localizedWeekOfYear(date, dateDow);
days = weeks * 7 + (dow - dateDow);
}
}
fieldValues.remove(this);
fieldValues.remove(this._weekDef.weekOfWeekBasedYear());
fieldValues.remove(ChronoField.DAY_OF_WEEK);
return date;
}
if (fieldValues.containsKey(ChronoField.YEAR) === false) {
return null;
}
const isoDow = ChronoField.DAY_OF_WEEK.checkValidIntValue(fieldValues.get(ChronoField.DAY_OF_WEEK));
const dow = MathUtil.floorMod(isoDow - sow, 7) + 1;
const year = ChronoField.YEAR.checkValidIntValue(fieldValues.get(ChronoField.YEAR));
// const chrono = IsoChronology.INSTANCE; //TODO: Chronology.from(partialTemporal); // defaults to ISO
if (this._rangeUnit === ChronoUnit.MONTHS) { // week-of-month
if (fieldValues.containsKey(ChronoField.MONTH_OF_YEAR) === false) {
return null;
}
const value = fieldValues.remove(this);
let date;
let days;
if (resolverStyle === ResolverStyle.LENIENT) {
const month = fieldValues.get(ChronoField.MONTH_OF_YEAR);
date = LocalDate.of(year, 1, 1); // TODO: chrono.date(year, 1, 1);
date = date.plus(month - 1, ChronoUnit.MONTHS);
const dateDow = this._localizedDayOfWeek(date, sow);
const weeks = value - this._localizedWeekOfMonth(date, dateDow);
days = weeks * 7 + (dow - dateDow);
} else {
const month = ChronoField.MONTH_OF_YEAR.checkValidIntValue(fieldValues.get(ChronoField.MONTH_OF_YEAR));
date = LocalDate.of(year, month, 8); // TODO: chrono.date(year, month, 8);
const dateDow = this._localizedDayOfWeek(date, sow);
_createStore(field, locale) {
Cldr.load(cldrData(`main/${locale.localeString()}/ca-gregorian.json`));
const cldr = new Cldr(locale.localeString());
if (field === ChronoField.MONTH_OF_YEAR) {
const monthsData = cldr.main('dates/calendars/gregorian/months/format');
const styleMap = {};
let data = {};
data[1] = monthsData.wide[1];
data[2] = monthsData.wide[2];
data[3] = monthsData.wide[3];
data[4] = monthsData.wide[4];
data[5] = monthsData.wide[5];
data[6] = monthsData.wide[6];
data[7] = monthsData.wide[7];
data[8] = monthsData.wide[8];
data[9] = monthsData.wide[9];
data[10] = monthsData.wide[10];
data[11] = monthsData.wide[11];
data[12] = monthsData.wide[12];
styleMap[TextStyle.FULL] = data;