cancel
Showing results for 
Search instead for 
Did you mean: 

DateNavigator - date range

former_member211905
Participant
0 Kudos

Hi,

I'm using a DateNavigator to choose a range of dates which I want to add to context. How can I add a range of dates to context value attributes? Also the lenght of the selected range may vary.

Regards

Øyvind

Accepted Solutions (0)

Answers (4)

Answers (4)

0 Kudos

Hi Guys,

Why are you using two Date Navigators for selecting a date range? You can, instead use one date navigator and set selectionMode property to range. Other values you can get from the properties of the dateNavigator UI; firstSelectedDate and lastSelectedDate.

Regards,

Aditya

Former Member
0 Kudos

hi,

you dont think about the logic..The logic is already built in it..U just need to substract one from the end date to first date or opposite...

you will get the exact dates between those..

Regards

AM

Former Member
0 Kudos

Do u mean to say , the context has to be created dynamically...There are many blogs to create elemnts dynamically...

if that is not necessary to add as many datecontext as the date range, i will suggest you an another solution..check if it helps..

date firstdt = wdCon.......getFirstSelDate

date scedt = wdco..........getLastSelDate

if you want the date range secdt.getDate-firstDt.getDate

if you want the dates inbetween these two days, you can build up logic by minusing one till the firstSelected date.

Regards

AM

former_member211905
Participant
0 Kudos

Hi,

yes, I want the dates between these two days. But I do not think it is a good solution if I have to build up my own logic by minusing one till the firstSelected date. As I said in my previous reply, this may be problematic when the dates are in two different months, and also take into account years with 366 days...

I think my solution is to add each date one by one, by using a button with its own action to put the chosen date into a context variable.

Regs

Øyvind

siarhei_pisarenka3
Active Contributor
0 Kudos

Hi

What a problem here? Use two date navigators, one for start date, second - for end date. Create two attributes of Date type in context. Then you can substract first date from the second one and get range in milliseconds.

BR

Sergei

former_member211905
Participant
0 Kudos

Ok I can do that, and just calculate how many days this is. But I thought it was an easier way to do this in wd using the datenavigator, because I still have to do some programming to handle for instance a date range from different months (varies from 28 days to 31 days). The point is I want to have one context variable for each day in the selected date range.

Regs

Øyvind