import { Month , MONTH_DAYS , MONTHS } from '../interfaces/date.interface' ; import { FormFieldOption } from '../interfaces/form.interface' ; param startDay param endDay export function getDays ( startDay = 1 , endDay = 31 ) { const days = [ ] ; for ( let day = startDay ; day <= endDay ; day ++ ) { days . push ( day ) ; } return days ; } param month param year export function getCountDaysByMonthAndYear ( month , year = 1 ) { let count = MONTH_DAYS [ month ] ; if ( month === Month . February && year % 4 === 0 ) { count = count + 1 ; } return count ; } param month param year export function getDaysByMonthAndYear ( month , year = 0 ) { const days = getCountDaysByMonthAndYear ( month , year ) ; return getDays ( 1 , days ) ; } param year param startYear param endYear export function getYears ( year ? , startYear = 0 , endYear = 100 ) { if ( ! year ) { year = new Date ( ) . getFullYear ( ) ; } const years = [ ] ; for ( let iterator = year - startYear , end = year - endYear ; iterator > end ; iterator -- ) { years . push ( iterator ) ; } return years ; } param langCase export function getMonthChoices ( langCase = 'nom' ) { const choices = [ ] ; for ( const month of Object . keys ( MONTHS ) ) { choices . push ( { value : + month , label : `months.${ langCase }.${ MONTHS [ month ] }` } ) ; } return choices ; }