{"record":{"id":"f244b3f8b08d2487","repo":"angular/components","slug":"invalid-minutes-minutes-minutes-value-must-b-f244b3","errorCode":null,"errorMessage":"Invalid minutes \"${minutes}\". Minutes value must be between 0 and 59.","messagePattern":"Invalid minutes \"(.+?)\"\\. Minutes value must be between 0 and 59\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/material-moment-adapter/adapter/moment-date-adapter.ts","lineNumber":252,"sourceCode":"    return moment.isMoment(obj);\n  }\n\n  isValid(date: Moment): boolean {\n    return this.clone(date).isValid();\n  }\n\n  invalid(): Moment {\n    return moment.invalid();\n  }\n\n  override setTime(target: Moment, hours: number, minutes: number, seconds: number): Moment {\n    if (typeof ngDevMode === 'undefined' || ngDevMode) {\n      if (hours < 0 || hours > 23) {\n        throw Error(`Invalid hours \"${hours}\". Hours value must be between 0 and 23.`);\n      }\n\n      if (minutes < 0 || minutes > 59) {\n        throw Error(`Invalid minutes \"${minutes}\". Minutes value must be between 0 and 59.`);\n      }\n\n      if (seconds < 0 || seconds > 59) {\n        throw Error(`Invalid seconds \"${seconds}\". Seconds value must be between 0 and 59.`);\n      }\n    }\n\n    return this.clone(target).set({hours, minutes, seconds, milliseconds: 0});\n  }\n\n  override getHours(date: Moment): number {\n    return date.hours();\n  }\n\n  override getMinutes(date: Moment): number {\n    return date.minutes();\n  }\n","sourceCodeStart":234,"sourceCodeEnd":270,"githubUrl":"https://github.com/angular/components/blob/0411926e7d8ae06b32236ec1048a888cfad5abf2/src/material-moment-adapter/adapter/moment-date-adapter.ts#L234-L270","documentation":"MomentDateAdapter.setTime validates the minutes argument (0-59) before applying it. Minutes outside that range would roll over into hours or create an invalid value, so the adapter throws this explicit ngDevMode error, alongside its sibling checks for hours and seconds.","triggerScenarios":"Calling setTime(target, hours, minutes, seconds) with minutes < 0 or > 59, e.g. passing total minutes of the day (0-1440) as the minute field, or negative values from subtracting offsets.","commonSituations":"Confusing 'minutes of day' with 'minutes of hour', duration math passed directly as the minutes component, timezone-offset subtraction producing negative minutes, transposed argument order.","solutions":["Convert first: if you have minutes-of-day, compute hour = Math.floor(m/60), minute = m % 60 and pass both correctly.","Clamp minutes to 0-59 after validating upstream data.","Check arithmetic producing minutes for unit issues (seconds vs minutes vs ms).","Verify setTime argument order: (target, hours, minutes, seconds)."],"exampleFix":"// before\nadapter.setTime(date, 0, minutesOfDay, 0); // minutesOfDay can be 725\n// after\nadapter.setTime(date, Math.floor(minutesOfDay / 60), minutesOfDay % 60, 0);","handlingStrategy":"validation","validationCode":"function canSetTime(h: number, m: number, s: number): boolean {\n  return [h, m, s].every(Number.isInteger) && h >= 0 && h <= 23 && m >= 0 && m <= 59 && s >= 0 && s <= 59;\n}","typeGuard":"function isValidMinutes(m: unknown): m is number {\n  return typeof m === 'number' && Number.isInteger(m) && m >= 0 && m <= 59;\n}","tryCatchPattern":"try {\n  adapter.setTime(date, h, m, s);\n} catch (e) {\n  if (e instanceof Error && e.message.includes('Invalid minutes')) {\n    const total = h * 60 + m;\n    adapter.setTime(date, Math.floor(total / 60) % 24, total % 60, s);\n  } else throw e;\n}","preventionTips":["Split minutes-of-day into hours/minutes before setTime","Clamp minute inputs at the form layer","Check sign of computed minutes (offset subtraction can go negative)","Unit-test duration-to-component conversions"],"tags":["date-adapter","moment","validation","time"],"backgroundTag":"invalid-time-component","analyzedSha":"0411926e7d8ae06b32236ec1048a888cfad5abf2","analyzedAt":"2026-08-31T11:58:23.400Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}