"use strict";(self.webpackChunk_department_of_veterans_affairs_component_library=self.webpackChunk_department_of_veterans_affairs_component_library||[]).push([[817],{817:function(e,r,n){n.r(r),n.d(r,{a:function(){return D},b:function(){return b},d:function(){return h},f:function(){return m},g:function(){return y},i:function(){return Y},m:function(){return u},v:function(){return g},z:function(){return _}}),n(2265),n(9213);var a=(new Date).getFullYear()+100,t=1900,i=12,o=1,l=1,u=[{label:"January",value:1},{label:"February",value:2},{label:"March",value:3},{label:"April",value:4},{label:"May",value:5},{label:"June",value:6},{label:"July",value:7},{label:"August",value:8},{label:"September",value:9},{label:"October",value:10},{label:"November",value:11},{label:"December",value:12}],d=["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30"],v=["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31"],f={1:v,2:["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29"],3:v,4:d,5:v,6:d,7:v,8:v,9:d,10:v,11:d,12:v},c=["year-range","day-range","month-range","date-error","month-select"];function s(e){return e?"month-select":"month-range"}function g(e){var r=e.component,n=e.year,u=e.month,d=e.day,v=e.monthYearOnly,f=e.yearTouched,g=e.monthTouched,y=e.dayTouched,m=e.monthSelect,b=e.monthOptional;if(n||u||d){var D=h(n,u);r.invalidYear=!1,r.invalidMonth=!1,r.invalidDay=!1;var Y=!(v&&b);if(Y&&isNaN(u)&&g)return r.invalidMonth=!0,void(r.error=s(m));if(!v&&isNaN(d)&&y)return r.invalidDay=!0,void(r.error="day-range");if(isNaN(n)&&f)return r.invalidYear=!0,void(r.error="year-range");if(r.required&&(!n||Y&&!u||!v&&!d)){if(Y&&g&&!u)return r.invalidMonth=!0,void(r.error="date-error");if(y&&!d&&!v)return r.invalidDay=!0,void(r.error="date-error");if(f&&!n)return r.invalidYear=!0,void(r.error="date-error")}if(Y&&!u&&g)return r.invalidMonth=!0,void(r.error=s(m));if(!d&&!v&&y)return r.invalidDay=!0,void(r.error="day-range");if(!n&&f)return r.invalidYear=!0,void(r.error="year-range");if(Y&&u&&(u<o||u>i)&&g)return r.invalidMonth=!0,void(r.error=s(m));if(d&&!v&&(d<l||d>D)&&y)return r.invalidDay=!0,void(r.error="day-range");if(n&&(n<t||n>a)&&f)return r.invalidYear=!0,void(r.error="year-range");if(!u||!g||y||f)return u&&g&&d&&y&&!f?(r.invalidYear=!0,void(r.error="date-error")):void(r.invalidYear||r.invalidMonth||r.invalidDay||r.error&&!c.includes(r.error)||(r.error=null));v?(r.invalidYear=!0,r.error="date-error"):(r.invalidDay=!0,r.error="date-error")}}function y(e,r,n){var o=h(r,n);switch(e){case"month-range":case"month-select":return{start:1,end:i};case"day-range":return{start:1,end:o};case"year-range":return{start:t,end:a};default:return null}}var h=function(e,r){var n;return e&&r?new Date(e,r,0).getDate():(null===(n=f[r])||void 0===n?void 0:n.length)||31},m=function(e,r,n){if(void 0===r&&(r={dateStyle:"full",timeStyle:"short"}),void 0===n&&(n="America/New_York"),e&&e instanceof Date)return e.toLocaleString("en-US",Object.assign(Object.assign({},r),{timeZone:n}))},b=function(e,r){if(e&&e instanceof Date&&r&&r instanceof Date)return e.getTime()>r.getTime()},D=function(e,r){if(e&&e instanceof Date&&r&&r instanceof Date)return e.getTime()<r.getTime()},Y=function(e,r){if(e&&e instanceof Date&&r&&r instanceof Date)return e.getFullYear()===r.getFullYear()&&e.getMonth()===r.getMonth()&&e.getDay()===r.getDay()},_=function(e){return"00".concat((e||"").toString()).slice(-2)}}}]);