@Explode( dateRange ) - a challenge

I have a field on a form as follows:

REM {DoDateRange is a flag that ensures the field won’t be huge} ;

@If(DoDateRange = “Yes” ;

     "" ; @Return("")) ;

sDate := @Text(StartDate; “S0”) ;

eDate := @Text(EndDate; “S0”) ;

date := @Eval( “@Explode( [” + sDate + “-” + eDate + “] )” ) ;

@If( @IsError(date) ; “” ; @TextToTime(@Text(date; “S0”)) )

This formula is working for associates all over Europe (with various time/date settings) without issue but once we hit Poland I get “Unable to interpret Time or Date” ???

I have tried numerous formats, even pulling apart the date values into their component elements (@day, @month, @year) and then rebuilding them but no joy. It seems that no matter what I do Polish users are not going to see the fully exploded date range…

Any suggestions/ideas welcome.

I also looked into how the mailfile does this (as I guessed this had to work for everyone!?) and found the wonderfully undocumented “NotesCSEventOwnerDocument”. Tried to use the method “.SetCalendarDateTime” and opened up all sorts of red boxes!

many thanks…

Subject: @Explode( dateRange ) - a challenge

Having spent some time on this and played around a bit I have come up with the following:

Use a post open event to set a “date format” flag…

Sub Postopen(source As Notesuidocument)

If source.IsNewDoc Then

	'only run through the field setting if this is a new document...

	Dim session As New NotesSession

	Dim international As NotesInternational

	Set international = session.International

	

	If international.IsDateDMY Then

		Call doc.ReplaceItemValue("DatesStyleFlag", "DMY")

	Elseif international.IsDateMDY Then

		Call doc.ReplaceItemValue("DatesStyleFlag", "MDY")

	Elseif international.IsDateYMD Then

		Call doc.ReplaceItemValue("DatesStyleFlag", "YMD")

	Else

		Call doc.ReplaceItemValue("DatesStyleFlag", "UNKNOWN")

	End If

	Call source.Refresh

End If	

End Sub

Then this formula then computes the range based on the format set in postOpen. Except for a little tidying up, I think it’s about the best soloution I’m going to be able to dream up, but any alternatives are still welcome…

REM {Only build up the range where the field will not exceed 32K limit} ;

REM {n.b. we’re not really near the 32K limit, just keep small for better performance } ;

REM {NOTE: The DatesStyleFlag field is set in the postOpen event} ;

@If( DoDateRange = “Yes” ;

		"" ; @Return("")) ;

REM {Day Month Year ---------------------------------------------------------------------------------------------------} ;

sDateDMY := @Right(“00” + @Text(@Day(StartDate)); 2) + “/” +

						@Right("00" + @Text(@Month(StartDate)); 2) + "/" +

							@Text(@Year(StartDate)) ;

eDateDMY := @Right(“00” + @Text(@Day(EndDate)); 2) + “/” +

						@Right("00" + @Text(@Month(EndDate)); 2) + "/" +

							@Text(@Year(EndDate)) ;

REM {Month Day Year ---------------------------------------------------------------------------------------------------} ;

sDateMDY := @Right(“00” + @Text(@Month(StartDate)); 2) + “/” +

						@Right("00" + @Text(@Day(StartDate)); 2)  + "/" +

							@Text(@Year(StartDate)) ;

eDateMDY := @Right(“00” + @Text(@Month(EndDate)); 2) + “/” +

						@Right("00" + @Text(@Day(EndDate)); 2) + "/" +

							@Text(@Year(EndDate)) ;

REM {Year Month Day ---------------------------------------------------------------------------------------------------} ;

sDateYMD := @Text(@Year(StartDate)) + “/” +

						@Right("00" + @Text(@Month(StartDate)); 2) + "/" +

							@Right("00" + @Text(@Day(StartDate)); 2) ;

eDateYMD := @Text(@Year(EndDate)) + “/” +

						@Right("00" + @Text(@Month(EndDate)); 2) + "/" +

							@Right("00" + @Text(@Day(EndDate)); 2) ;

sDate := @If( DatesStyleFlag = “DMY” ; sDateDMY ;

					DatesStyleFlag = "MDY" ; sDateMDY ;

					DatesStyleFlag = "YMD" ; sDateYMD ;

					"" ) ;

eDate := @If( DatesStyleFlag = “DMY” ; eDateDMY ;

					DatesStyleFlag = "MDY" ; eDateMDY ;

					DatesStyleFlag = "YMD" ; eDateYMD ;

					"" ) ;

date := @Eval( “@Explode( [” + sDate + “-” + eDate + “] )” ) ;

@If( @IsError(date) ; “” ; @TextToTime(@Text(date; “S0”)) )