#-- WARNING : be careful to white-space and lines break in FreeMarker macros.
# This macro template can be used to output white-space-sensitive formats (like RSS files).
# See http://dev.lutece.paris.fr/jira/browse/LUTECE-765
-->
<#assign styleUrl='css/bootstrap-flatpickr.min.css' />
<#macro getDate idField language=.lang format='' showFormat='' minDate='' maxDate='' defaultDate='' dateOptions={} >
<#local dtOptions=dateOptions />
<@initScriptFlatPicker language=language />
#macro>
<#macro getDateTime idField language=.lang format='' showFormat='' minDate='' maxDate='' defaultDate='' minTime='' maxTime='' defaultTime='' dateOptions={} >
<@initScriptFlatPicker language=language />
#macro>
<#macro getDateRange idField idEndField language=.lang format='' showFormat='' minDate='' maxDate='' defaultDate='' dateOptions={} >
<@initScriptFlatPicker language=language range=true/>
#macro>
<#macro getDateTimeRange idField idEndField language=.lang format='' showFormat='' minDate='' maxDate='' defaultDate='' minTime='' maxTime='' defaultTime='' dateOptions={}>
<@initScriptFlatPicker language=language range=true />
#macro>
<#macro getTime idField language=.lang format='H:i' showFormat='H:i' defaultDate='' minTime='' maxTime='' time_24hr=true dateOptions={}>
<@initScriptFlatPicker language=language range=true />
#macro>
<#-- getLanguageInLocale
# This macro should not be called directly
#
-->
<#macro getLanguageInLocale language><#if language?index_of("_") gt 0>${language?keep_before("_")}<#else>${language}#if>#macro>
<#-- getDateFormat
# This macro should not be called directly
#
-->
<#macro getDateFormat format showFormat time=false>
<#if showFormat == ''>
const showFormat = getFlatPickerDateFormat( browserCurrentLocale )<#if time> + ' ' + getFlatPickerTimeFormat( browserCurrentLocale )#if>;
<#else>
const showFormat = '${showFormat}';
#if>
<#-- The server parses dates on a per locale basis. The formats here much match those specified by lutece.format.date.short -->
<#if format == ''>
const dtFormat='Y-m-d H:i:S'; // Default for most DB
<#else>
const dtFormat='${format}';
#if>
<#if time>
#if>
#macro>
<#-- initScriptFlatPicker
# This macro should not be called directly
#
-->
<#macro initScriptFlatPicker language range=false>
<#if datePickerIsLoaded?? && datePickerIsLoaded>
<#else>
<#if range >#if>
<#assign isEn=language?starts_with("en")?c />
<#if !isEn?boolean >#if>
#macro>
<#function setFlatPickerOptions options>
<#assign strOptions=''>
<#if options?size gt 0><#assign strOptions><#list options as optionKey, optionVal>"${optionKey}" : <#if optionVal?is_boolean>${optionVal?c}<#elseif optionVal?is_number>${optionVal}<#else>"${optionVal}"#if>,#list> #assign>#if>
<#return strOptions>
#function>