Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    can't change startYear and endYear DateChooser defaults

    SmartClient Version: v8.3d_2012-11-13/PowerEdition Development Only (built 2012-11-13)

    Chrome 23.0.1271.64 on Mac OSX
    Safari 6.0.2 (8536.26.17)

    adding this code in the sample #dateRangeFilter
    Code:
    isc.DateChooser.addProperties({
        startYear: 2007,
    	endYear: 2027,
        firstDayOfWeek:1
    });
    correctly changes the first day of week in the date chooser, but startYear is 1995 and endYear is 2015

    #2
    If you're trying to change the DateChooser automatically launched by a DateItem, you'll need to change the defaults for DateItem startDate/endDate.

    Comment


      #3
      thank you very much

      this works:
      Code:
      isc.DateItem.addProperties({
          startDate:isc.Date.createLogicalDate(new Date().getFullYear() - 5, 1, 1),
          endDate:isc.Date.createLogicalDate(new Date().getFullYear() + 14, 12, 31)
      });
      isc.RelativeDateItem.addProperties({
          startDate:isc.Date.createLogicalDate(new Date().getFullYear() - 5, 1, 1),
          endDate:isc.Date.createLogicalDate(new Date().getFullYear() + 14, 12, 31)
      });

      Comment


        #4
        Originally posted by claudiobosticco View Post
        thank you very much

        this works:
        Code:
        isc.DateItem.addProperties({
        startDate:isc.Date.createLogicalDate(new Date().getFullYear() - 5, 1, 1),
        endDate:isc.Date.createLogicalDate(new Date().getFullYear() + 14, 12, 31)
        });
        isc.RelativeDateItem.addProperties({
        startDate:isc.Date.createLogicalDate(new Date().getFullYear() - 5, 1, 1),
        endDate:isc.Date.createLogicalDate(new Date().getFullYear() + 14, 12, 31)
        });
        Hello, this is giving me a validation error with the latest 13.1, please try this test case:

        Code:
        isc.DateItem.addProperties({
            startDate: isc.Date.createLogicalDate(new Date().getFullYear() - 5, 1, 1, 0, 0, 0),
            endDate: isc.Date.createLogicalDate(new Date().getFullYear() + 14, 12, 31, 0, 0, 0)
        })
        
        isc.DynamicForm.create({
            ID: "dateForm",
            numCols: 4,
            width: 650,
            fields: [
                {name:"directInputDate", title:"Direct Input Date", type:"date", useTextField:true, wrapTitle:false, defaultValue:new Date(2000, 0, 1)}
            ]
        });
        
        isc.IButton.create({
            title: "Validate",
            top:50,
            click: "dateForm.validate()"
        })
        the validation fails if the date is outside the range DateItem.startDate-endDate

        Comment


          #5
          Note that the error is raised also if you add startDate/endDate to a single dateItem.

          Comment


            #6
            hi Claudio,

            The dateRange-validator is generated automatically here, if you don't add one - if you don't want the startDate/endDate range to be enforced in this way, you can set item.generateValidator to false.

            Comment


              #7
              Hi, thanks for the clarification, so it's a new feature, cool.

              I was actually interested in customizing the dateChooserYearMenu, and now I have two questions:
              1. is it correct to set DateItem.start/endDate and generateValidator:false to customize the range of years visible in the dateChooserYearMenu without create a validator? I also saw the startYear/startYearRange attributes but I didn't understand if I can change them (not globally).
              2. Why do the dateChooserNavButtons not allow navigation beyond the displayed range, when there is no validator set?
              Last edited by claudiobosticco; 11 Jun 2024, 05:46.

              Comment


                #8
                1) The startYear / startYearRange attributes on DateChooser are for direct use of the DateChooser outside of DateItem. When the DateChooser is generated by a DateItem, the DateItem sets these automatically based on dateItem.startDate/endDate.

                2) If startDate/endDate do not limit the navigation of the DateChooser, what are you hoping for them to do?

                If you are hoping that the dropdown has a limited range of years but it is still secretly possible to enter other years via the DateChooser, that's definitely not something we'd want to do.

                Comment


                  #9
                  Originally posted by Isomorphic View Post
                  2) If startDate/endDate do not limit the navigation of the DateChooser, what are you hoping for them to do?

                  If you are hoping that the dropdown has a limited range of years but it is still secretly possible to enter other years via the DateChooser, that's definitely not something we'd want to do.
                  I must specify that I'm thinking of the "useTextField" use case, without any startDate/endDate defined in my code. In this case, I can enter a random date, but if I open the DateChooser I'm limited to the range of the dateChooserYearMenu, even if I use the dateChooserNavButtons.
                  Also if I enter a random date in the year 1900, and open the DateChooser, I see this:

                  Click image for larger version

Name:	2024-06-11 20.37.55.jpg
Views:	17
Size:	36.2 KB
ID:	272553

                  where the years are enabled, because there are only the "valid" years, and the dateChooserNavMonth/Year buttons are disabled. Then the dateChooserMonthMenu is disabled, but the days are enabled, even the "otherDays", so you can effectively use those to change month and eventually also year.

                  I may be wrong (as i'm a user that normally types dates*), but I have the feeling that it is a logic that may not be appreciated by less technical users.

                  (*) especially because useTextField in combination with the mask is really a very good UX in my opinion

                  Comment

                  Working...
                  X