-
Notifications
You must be signed in to change notification settings - Fork 2
How to Usage?
Rabin Koirala edited this page Dec 11, 2023
·
2 revisions
Check on client side for latest Code
frappe.ui.form.on("Nepali Date Demo", {
refresh(frm) {
add_nepali_date_picker(frm, "nepali_date"); // if you dont want to add nepali date only
add_nepali_date_picker(frm, "nepali_date_convert", "english_date_convert"); // if you want to add nepali date and convert to english date
add_nepali_date_picker(frm, "nepali_date_time_convert", "english_datetime_convert"); // convert in time field
add_nepali_date_picker(frm, "nepali_date_convert_one", "english_date_convert_one");
},
english_date_convert(frm) {
frappe.model.set_value(frm.doctype, frm.docname, "nepali_date_convert", NepaliFunctions.AD2BS(frm.doc.english_date_convert.split(" ")[0], "YYYY-MM-DD", "YYYY-MM-DD"));
},
english_datetime_convert(frm) {
frappe.model.set_value(frm.doctype, frm.docname, "nepali_date_convert", NepaliFunctions.AD2BS(frm.doc.english_datetime_convert.split(" ")[0], "YYYY-MM-DD", "YYYY-MM-DD"));
},
english_date_convert_one(frm) {
frappe.model.set_value(frm.doctype, frm.docname, "nepali_date_convert_one", NepaliFunctions.AD2BS(frm.doc.english_date_convert_one.split(" ")[0], "YYYY-MM-DD", "YYYY-MM-DD"));
},
english_datetime_convert_one(frm) {
frappe.model.set_value(frm.doctype, frm.docname, "nepali_date_convert_one", NepaliFunctions.AD2BS(frm.doc.english_datetime_convert_one.split(" ")[0], "YYYY-MM-DD", "YYYY-MM-DD"));
}
});
NepaliDate (BS)