define(["require","exports","date-fns"],function(require,exports,DateFNS){Object.defineProperty(exports,"__esModule",{value:true});var DateFnsUtils=function(){function DateFnsUtils(_temp){var _ref=_temp===void 0?{}:_temp,locale=_ref.locale;this.addDays=DateFNS.addDays;this.isValid=DateFNS.isValid;this.getDiff=DateFNS.differenceInMilliseconds;this.isAfter=DateFNS.isAfter;this.isBefore=DateFNS.isBefore;this.startOfDay=DateFNS.startOfDay;this.startOfMonth=DateFNS.startOfMonth;this.startOfYear=DateFNS.startOfYear;this.endOfDay=DateFNS.endOfDay;this.getHours=DateFNS.getHours;this.setHours=DateFNS.setHours;this.setMinutes=DateFNS.setMinutes;this.getSeconds=DateFNS.getSeconds;this.setSeconds=DateFNS.setSeconds;this.isSameDay=DateFNS.isSameDay;this.getStartOfMonth=DateFNS.startOfMonth;this.getYear=DateFNS.getYear;this.setYear=DateFNS.setYear;this.dateTime12hFormat='MMMM do hh:mm aaaa';this.dateTime24hFormat='MMMM do HH:mm';this.time12hFormat='hh:mm a';this.time24hFormat='HH:mm';this.dateFormat='MMMM do';this.locale=locale;} var _proto=DateFnsUtils.prototype;_proto.date=function date(value){if(typeof value==='undefined'){return new Date();} if(value===null){return null;} return new Date(value);};_proto.parse=function parse(value,formatString){if(value===''){return null;} return DateFNS.parse(value,formatString,new Date());};_proto.format=function format(date,formatString){return DateFNS.format(date,formatString,{locale:this.locale});};_proto.isEqual=function isEqual(date,comparing){if(date===null&&comparing===null){return true;} return DateFNS.isEqual(date,comparing);};_proto.isValid=function isValid(date){return date===DateFNS.isValid(date);};_proto.isNull=function isNull(date){return date===null;};_proto.isAfterDay=function isAfterDay(date,value){return DateFNS.isAfter(date,DateFNS.endOfDay(value));};_proto.isBeforeDay=function isBeforeDay(date,value){return DateFNS.isBefore(date,DateFNS.startOfDay(value));};_proto.isBeforeYear=function isBeforeYear(date,value){return DateFNS.isBefore(date,DateFNS.startOfYear(value));};_proto.isAfterYear=function isAfterYear(date,value){return DateFNS.isAfter(date,DateFNS.endOfYear(value));};_proto.formatNumber=function formatNumber(num){return num;};_proto.getMinutes=function getMinutes(date){return date.getMinutes();};_proto.getMonth=function getMonth(date){return date.getMonth();};_proto.getMeridiemText=function getMeridiemText(ampm){return ampm==='am'?'AM':'PM';};_proto.getNextMonth=function getNextMonth(date){return DateFNS.addMonths(date,1);};_proto.getPreviousMonth=function getPreviousMonth(date){return DateFNS.addMonths(date,-1);};_proto.mergeDateAndTime=function mergeDateAndTime(date,time){return this.setMinutes(this.setHours(date,this.getHours(time)),this.getMinutes(time));};_proto.getWeekdays=function getWeekdays(){var _this=this;var now=new Date();return DateFNS.eachDayOfInterval({start:DateFNS.startOfWeek(now,{locale:this.locale}),end:DateFNS.endOfWeek(now,{locale:this.locale})},{locale:this.locale}).map(function(day){return DateFNS.format(day,'EEEEEE',{locale:_this.locale});});};_proto.getWeekArray=function getWeekArray(date){var start=DateFNS.startOfWeek(DateFNS.startOfMonth(date),{locale:this.locale});var end=DateFNS.endOfWeek(DateFNS.endOfMonth(date),{locale:this.locale});var nestedWeeks=[];var count=0;var current=start;while(DateFNS.isBefore(current,end)){var weekNumber=Math.floor(count/7);nestedWeeks[weekNumber]=nestedWeeks[weekNumber]||[];nestedWeeks[weekNumber].push(current);current=DateFNS.addDays(current,1);count+=1;} return nestedWeeks;};_proto.getYearRange=function getYearRange(start,end){var startDate=DateFNS.startOfYear(new Date(start));var endDate=DateFNS.endOfYear(new Date(end));var years=[];var current=startDate;while(DateFNS.isBefore(current,endDate)){years.push(current);current=DateFNS.addYears(current,1);} return years;};_proto.getCalendarHeaderText=function getCalendarHeaderText(date){return DateFNS.format(date,'MMMM yyyy',{locale:this.locale});};_proto.getYearText=function getYearText(date){return DateFNS.format(date,'yyyy',{locale:this.locale});};_proto.getDatePickerHeaderText=function getDatePickerHeaderText(date){return DateFNS.format(date,'EEE, MMM d',{locale:this.locale});};_proto.getDateTimePickerHeaderText=function getDateTimePickerHeaderText(date){return DateFNS.format(date,'MMM d',{locale:this.locale});};_proto.getDayText=function getDayText(date){return DateFNS.format(date,'d',{locale:this.locale});};_proto.getHourText=function getHourText(date,ampm){return DateFNS.format(date,ampm?'hh':'HH',{locale:this.locale});};_proto.getMinuteText=function getMinuteText(date){return DateFNS.format(date,'mm',{locale:this.locale});};_proto.getSecondText=function getSecondText(date){return DateFNS.format(date,'ss',{locale:this.locale});};return DateFnsUtils;}();exports.default=DateFnsUtils;});