code: function patientBirthdayRep(patient) {
      let b = patient.birthday;
      if (b === "0000-00-00") {
          return "";
      }
      let m = moment(b);
      if (!m.isValid()) {
          return `（生年月日が不適切：${b}）`;
      }
      return kanjidate.format(kanjidate.f2, m.format("YYYY-MM-DD")) + "生";
  }
docs: export class PatientValues { public patientId: NumberValue; public lastName: StringValue; public firstName: StringValue; public lastNameYomi: StringValue; public firstNameYomi: StringValue; public birthday: StringValue; public sex: StringValue; public address: StringValue; public phone: StringValue } function hasError(values: PatientValues): boolean { return values.patientId.isError || values.lastName.isError || values.firstName.isError || values.lastNameYomi.isError || values.firstNameYomi.isError || values.birthday.isError || values.sex.isError || values.address.isError || values.phone.isError; } export function validatePatient(patient: Patient): null | PatientValues { let v = new PatientValues(); v.patientId = ensureNumber(patient.patientId) .isInteger() .isPositive() v.lastName = ensureString(patient.lastName) .isNotEmpty() v.firstName = ensureString(patient.firstName) .isNotEmpty() v.lastNameYomi = ensureString(patient.lastNameYomi) .isNotEmpty() v.firstNameYomi = ensureString(patient.firstNameYomi) .isNotEmpty() v.birthday = ensureString(patient.birthday) .isSqlDate() .isZeroOrValidDate() v.sex = ensureString(patient.sex) .oneOf("M", "F") v.address = ensureString(patient.address) v.phone = ensureString(patient.phone) if( hasError(v) ){ return v; } else { return null; } }