<commit_before>frappe.ui.form.on("System Settings", {
	refresh: function(frm) {
		frappe.call({
			method: "frappe.core.doctype.system_settings.system_settings.load",
			callback: function(data) {
				frappe.all_timezones = data.message.timezones;
				frm.set_df_property("time_zone", "options", frappe.all_timezones);

				$.each(data.message.defaults, function(key, val) {
					frm.set_value(key, val);
					frappe.sys_defaults[key] = val;
				});
			}
		});
	},
	enable_password_policy: function(frm) {
		if (frm.doc.enable_password_policy == 0) {
			frm.set_value("minimum_password_score", "");
		} else {
			frm.set_value("minimum_password_score", "2");
		}
	},
	enable_two_factor_auth: function(frm) {
		if (frm.doc.enable_two_factor_auth == 0) {
			frm.set_value("bypass_2fa_for_retricted_ip_users", 0);
			frm.set_value("bypass_restrict_ip_check_if_2fa_enabled", 0);
		}
	},
	enable_prepared_report_auto_deletion: function(frm) {
		if (frm.doc.enable_prepared_report_auto_deletion) {
			if (!frm.doc.prepared_report_expiry_period) {
				frm.set_value('prepared_report_expiry_period', 7);
			}
		}
	},
	on_update: function(frm) {
		if (frappe.boot.time_zone && frappe.boot.time_zone.system !== frm.doc.time_zone) {
			// Clear cache after saving to refresh the values of boot.
			frappe.ui.toolbar.clear_cache();
		}
	}
});
<commit_msg>fix: Re-setup moment object whenever `week_starts_on` is changed<commit_after>frappe.ui.form.on("System Settings", {
	refresh: function(frm) {
		frappe.call({
			method: "frappe.core.doctype.system_settings.system_settings.load",
			callback: function(data) {
				frappe.all_timezones = data.message.timezones;
				frm.set_df_property("time_zone", "options", frappe.all_timezones);

				$.each(data.message.defaults, function(key, val) {
					frm.set_value(key, val);
					frappe.sys_defaults[key] = val;
				});
				if (frm.re_setup_moment) {
					frappe.app.setup_moment();
					delete frm.re_setup_moment;
				}
			}
		});
	},
	enable_password_policy: function(frm) {
		if (frm.doc.enable_password_policy == 0) {
			frm.set_value("minimum_password_score", "");
		} else {
			frm.set_value("minimum_password_score", "2");
		}
	},
	enable_two_factor_auth: function(frm) {
		if (frm.doc.enable_two_factor_auth == 0) {
			frm.set_value("bypass_2fa_for_retricted_ip_users", 0);
			frm.set_value("bypass_restrict_ip_check_if_2fa_enabled", 0);
		}
	},
	enable_prepared_report_auto_deletion: function(frm) {
		if (frm.doc.enable_prepared_report_auto_deletion) {
			if (!frm.doc.prepared_report_expiry_period) {
				frm.set_value('prepared_report_expiry_period', 7);
			}
		}
	},
	on_update: function(frm) {
		if (frappe.boot.time_zone && frappe.boot.time_zone.system !== frm.doc.time_zone) {
			// Clear cache after saving to refresh the values of boot.
			frappe.ui.toolbar.clear_cache();
		}
	},
	week_starts_on(frm) {
		frm.re_setup_moment = true;
	},
});

{'fraction_non_alphanumeric': 0.14463237832240247, 'fraction_numerical': 0.005522954780807732, 'mean_word_length': 4.437148217636023, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4328730', 'n_tokens_mistral': 1282, 'n_tokens_neox': 1139, 'n_words': 143}