11import { expect } from '@open-wc/testing' ;
2+ import { normalizeDateTime } from '@lion/localize' ;
23import { smokeTestValidator } from '../test-helpers.js' ;
34
45import {
@@ -134,11 +135,17 @@ describe('LionValidate', () => {
134135 it ( 'provides minDate() to allow only dates after min' , ( ) => {
135136 expect ( minDate ( new Date ( '2018-02-03' ) , new Date ( '2018/02/02' ) ) ) . to . be . true ;
136137 expect ( minDate ( new Date ( '2018-02-01' ) , new Date ( '2018/02/02' ) ) ) . to . be . false ;
138+ const today = new Date ( ) ;
139+ const todayFormatted = normalizeDateTime ( today ) ;
140+ expect ( minDate ( todayFormatted , today ) ) . to . be . true ;
137141 } ) ;
138142
139143 it ( 'provides maxDate() to allow only dates before max' , ( ) => {
140144 expect ( maxDate ( new Date ( '2018-02-01' ) , new Date ( '2018/02/02' ) ) ) . to . be . true ;
141145 expect ( maxDate ( new Date ( '2018-02-03' ) , new Date ( '2018/02/02' ) ) ) . to . be . false ;
146+ const today = new Date ( ) ;
147+ const todayFormatted = normalizeDateTime ( today ) ;
148+ expect ( maxDate ( todayFormatted , today ) ) . to . be . true ;
142149 } ) ;
143150
144151 it ( 'provides minMaxDate() to allow only dates between min and max' , ( ) => {
@@ -149,6 +156,9 @@ describe('LionValidate', () => {
149156 expect ( minMaxDate ( new Date ( '2018/02/03' ) , minMaxSetting ) ) . to . be . true ;
150157 expect ( minMaxDate ( new Date ( '2018/02/01' ) , minMaxSetting ) ) . to . be . false ;
151158 expect ( minMaxDate ( new Date ( '2018/02/05' ) , minMaxSetting ) ) . to . be . false ;
159+ const today = new Date ( ) ;
160+ const todayFormatted = normalizeDateTime ( today ) ;
161+ expect ( minMaxDate ( todayFormatted , { min : today , max : today } ) ) . to . be . true ;
152162 } ) ;
153163
154164 it ( 'provides isDateDisabled() to disable dates matching specified condition' , ( ) => {
0 commit comments