r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[Core] Discuss core issues

Volker
24-Oct-2005
[2453]
(i guess there is nothing inbuild, but would be pleasanly surprised 
if i am wrong :)
Graham
24-Oct-2005
[2454x2]
I want to automatically set a window so I can deal with dates - for 
birthdates and appts.
If I have to, I will have to write my own mezzaine - just was hoping 
that Rebol had something built in.
Volker
24-Oct-2005
[2456]
I guess that step must be made in the conversion, to check if date 
is 2 or 4 digits.
Graham
24-Oct-2005
[2457]
I guess when it was coded, it was set to make everything the current 
century .. after all Rebol was invented last century.
Volker
24-Oct-2005
[2458]
if you know its 2, you can then make a quick check. if date > 2035 
[date: date - 100]
Graham
24-Oct-2005
[2459]
yeah ..
Volker
24-Oct-2005
[2460]
so we need a to-date/window ? How to deal with different formats?
Graham
24-Oct-2005
[2461]
what different formats?
Volker
24-Oct-2005
[2462]
thought to-date understands ultiple formats. if its always */year 
its a short check.
Graham
24-Oct-2005
[2463]
yes, I thought using /year is what is needed.
Volker
24-Oct-2005
[2464]
there are some more mentioned in the word-browser. if always "/", 
if 2 = length? find/last "/" ..
Graham
24-Oct-2005
[2465x2]
to-date: func [ value /local tmp ][ tmp: to date! :value if tmp/year 
> ( now/year + 10 ) [ tmp/year: tmp/year - 100 ] tmp]
this ensures that years more than 10 ahead get changed
Volker
24-Oct-2005
[2467x2]
explicit 4 digits are not necessary?
but quick solution :)
Graham
24-Oct-2005
[2469]
Since we don't have control over the field .. users will enter 2 
digits sometimes
Volker
24-Oct-2005
[2470]
i mean user can enter 2025 explicitely. that gets 1925.
Graham
24-Oct-2005
[2471x3]
well, I see ... he made a mistake.
In my application .. you are not allowed to deal with dates too distant.
:)
Ladislav
24-Oct-2005
[2474]
this solution:

>> 24/10/55
== 24-Oct-1955
>> 24/10/54
== 24-Oct-2054
Volker
24-Oct-2005
[2475]
ok, than this is enough. but people get older in the future! (hopefully)
Ladislav
24-Oct-2005
[2476]
is considered "standard", but it doesn't look ideal for medicine 
applications
Anton
24-Oct-2005
[2477x3]
I would require users to enter four digits. Get them used to being 
precise.
sorry "we don't have control of the field..."
mmm.. so you have to guess. A bad situation.
Graham
24-Oct-2005
[2480]
Hey, living users won't have to worry about the next century!!
Volker
24-Oct-2005
[2481]
i would use grhams solution and feed what rebol sees back into the 
input-field. so user sees something is wrong.
Graham
24-Oct-2005
[2482]
Ladislav, how did you know the cut off date?
Volker
24-Oct-2005
[2483]
middle? 50 years?
Graham
24-Oct-2005
[2484x2]
ahh...
well, I think we need an adjustable window
Ladislav
24-Oct-2005
[2486]
adjustable window - you may put it to RAMBO as a request, but I am 
not sure if you succeed
Volker
24-Oct-2005
[2487]
would something in system/options be a big effort?
Graham
24-Oct-2005
[2488]
I thought RT wanted to get into medical applications :)
Ladislav
24-Oct-2005
[2489]
OK, try to put it there and let's see :-)
Graham
24-Oct-2005
[2490]
system/options sounds appropriate
Ladislav
24-Oct-2005
[2491]
currently it is -50 to 50 but even -100 to 0 isn't "safe" (ever heard 
anecdotes about inviting over 100 people to elementatry schools?)
Volker
24-Oct-2005
[2492x2]
I think it is importan if you get dates as strings, you dont know 
after the converion if it was 2 or 4 digits. makes the smartness 
of to-date useless, going back to self-made conversion. OTOH in most 
cases defaults are enough, but so are english month :)
main point may be, some dates cant be in the future, like being born.
Graham
24-Oct-2005
[2494]
110 - 0 should be enough
Ladislav
24-Oct-2005
[2495x2]
but impossible
it is more than 100
Graham
24-Oct-2005
[2497]
there are many centenarians around.
Ladislav
24-Oct-2005
[2498]
:-P
Graham
24-Oct-2005
[2499x2]
the Galapagos turtle that was said to have been brought back by Charles 
Darwin is over 160 years old now.
so, for vetinary applications, would have to adjust the date window 
even further.
Volker
24-Oct-2005
[2501]
maybe hexdates, going to 255? :)
Ladislav
24-Oct-2005
[2502]
your trouble is, that the window is only 100 years wide