Project

General

Profile

Automatic dates (client side) » History » Version 6

Elie Soubrie, 22/03/2012 10:25

1 1 Pablo Alingery
h1. Automatic dates (client side)
2 1 Pablo Alingery
3 6 Elie Soubrie
Ajout dans le fichier source:workspace/client-public/js/components/commons/forms/components/singleSelection/DateBetween.js@2#L37
4 1 Pablo Alingery
5 2 Pablo Alingery
<pre><code class="javascript">
6 1 Pablo Alingery
    var date1 = new Date();
7 1 Pablo Alingery
    	var numberOfDaysToRemove= 8;
8 1 Pablo Alingery
    	date1.setDate(date1.getDate()-numberOfDaysToRemove);
9 1 Pablo Alingery
    	date1.setHours(0, 0, 0, 0)
10 1 Pablo Alingery
        this.fieldFrom = new Ext.form.DateField({
11 1 Pablo Alingery
            allowBlank : true,
12 1 Pablo Alingery
            format : dateFormat, 
13 1 Pablo Alingery
            flex : 1,
14 1 Pablo Alingery
            //height : this.height,
15 1 Pablo Alingery
            //value : new Date(this.defaultValues[0]).format(dateFormat), 
16 1 Pablo Alingery
            //value : new Date("2010/09/02 23:00:00").format(dateFormat),
17 1 Pablo Alingery
            value : date1.format(dateFormat),
18 1 Pablo Alingery
            showTime : this.showTime
19 1 Pablo Alingery
        });
20 1 Pablo Alingery
    	var date2 = new Date();
21 1 Pablo Alingery
    	date2.setHours(0, 0, 0, 0);
22 1 Pablo Alingery
        this.fieldTo = new Ext.form.DateField({
23 1 Pablo Alingery
            allowBlank : true,
24 1 Pablo Alingery
            format : dateFormat, 
25 1 Pablo Alingery
            flex : 1,
26 1 Pablo Alingery
            //height : this.height,
27 1 Pablo Alingery
            //value : new Date(this.defaultValues[1]).format(dateFormat),
28 1 Pablo Alingery
            value : date2.format(dateFormat),
29 1 Pablo Alingery
            showTime : this.showTime
30 1 Pablo Alingery
        });
31 2 Pablo Alingery
</code></pre>