update 園児台帳 for update vlookup
This commit is contained in:
58
src/utils.js
58
src/utils.js
@@ -21,6 +21,7 @@ const classItems = [
|
||||
const errorEl = new Kuc.Notification({
|
||||
type: 'danger',
|
||||
});
|
||||
let loadingEl;
|
||||
|
||||
function getHeaderSpace(className, isDetailPage) {
|
||||
const headerSpace = (isDetailPage ? kintone.app.record : kintone.app).getHeaderMenuSpaceElement();
|
||||
@@ -191,4 +192,61 @@ function hideSpaceField(ids) {
|
||||
|
||||
function getExcelName({ excelName }, nameSuffix = '', suffix = '.xlsx') {
|
||||
return excelName + (nameSuffix ? (nameSuffix.startsWith('_') ? nameSuffix : ('_' + nameSuffix)) : '') + suffix;
|
||||
}
|
||||
|
||||
function getJapaneseEraDate(date = new Date()) {
|
||||
const formatter = new Intl.DateTimeFormat('ja-JP-u-ca-japanese', {
|
||||
era: 'long',
|
||||
year: 'numeric',
|
||||
month: 'long',
|
||||
day: 'numeric'
|
||||
});
|
||||
const japaneseDate = formatter.format(date);
|
||||
|
||||
const match = japaneseDate.match(/(.+?)(元|\d+)年(\d+)月(\d+)日/);
|
||||
|
||||
if (!match) {
|
||||
throw new Error("日付の解析に失敗しました。");
|
||||
}
|
||||
|
||||
const era = match[1];
|
||||
const year = match[2] === "元" ? 1 : parseInt(match[2], 10);
|
||||
const month = parseInt(match[3], 10);
|
||||
const day = parseInt(match[4], 10);
|
||||
|
||||
return {
|
||||
japaneseDate,
|
||||
era,
|
||||
year,
|
||||
month,
|
||||
day,
|
||||
westernYear: date.getFullYear()
|
||||
};
|
||||
}
|
||||
|
||||
function convertToWesternYear(year, era) {
|
||||
return warekiStartYear[era] + year - 1;
|
||||
}
|
||||
|
||||
function getFormatDateString(date) {
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(date.getDate()).padStart(2, '0');
|
||||
|
||||
return `${year}-${month}-${day}`;
|
||||
}
|
||||
|
||||
function loading(show, text) {
|
||||
if (!loadingEl) {
|
||||
loadingEl = new Kuc.Spinner({
|
||||
container: document.querySelector('.container-gaia'),
|
||||
text
|
||||
});
|
||||
} else {
|
||||
loadingEl.close();
|
||||
loadingEl.text = text;
|
||||
}
|
||||
if (show) {
|
||||
loadingEl.open();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user