Start of a date handling library

Are you developing tools to extend the LiveCode environment? This is the place to talk about the nuts and bolts of extending our nuts and bolts. If you want to use a LiveCode or third party Environment extension, visit the Using Evironment Extensions forum.

Moderators: heatherlaine, Klaus, FourthWorld, robinmiller, kevinmiller

wilstrand
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 114
Joined: Mon Jan 03, 2011 3:02 pm
Contact:

Re: Start of a date handling library

Post by wilstrand » Tue Jul 02, 2013 10:08 am

Hi Malte!

A week can cover the end of one month and the start of next and even the end of a year and start of the next.
So I think it would good to have the results of a weekDates function as a list with one date per line and each date
complete with Year, Month and Day, comma separated. Year four digit, Month one or two digit and Day one or two digit.

All the best,
Mats
http:www.tapirsoft.on-rev.com
Open Source LiveCode Plugins - rIDE, rGrid, rTree
LiveCode projects

malte
Posts: 1098
Joined: Thu Feb 23, 2006 8:34 pm
Location: Ostenfeld germany
Contact:

Re: Start of a date handling library

Post by malte » Tue Jul 02, 2013 4:12 pm

For the complete year? Or For a month? Or? Does it need input parameters?

Cheers,

Malte

wilstrand
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 114
Joined: Mon Jan 03, 2011 3:02 pm
Contact:

Re: Start of a date handling library

Post by wilstrand » Tue Jul 02, 2013 8:43 pm

Malte!

Sorry, seems I did not think it through! I'll make another try!
My thought initially was that you give a date as parameters in the format:
libDate_weekDates (tYear,tMonth,tDay)

I will now, almost magically change my mind.

What I want is this:
function libDate_weekDates pYear,pWeekNumber

We can already easily get the week number with libDate_CalendarWeekISO (tYear,tMonth,tDay).
So Year and week number as parameters should be fine and cover the needs.
I still would like the result as a list with one date per line and each date complete with Year, Month
and Day, comma separated. Year four digit, Month one or two digit and Day one or two digit

All the best
Mats
http:www.tapirsoft.on-rev.com
Open Source LiveCode Plugins - rIDE, rGrid, rTree
LiveCode projects

malte
Posts: 1098
Joined: Thu Feb 23, 2006 8:34 pm
Location: Ostenfeld germany
Contact:

Re: Start of a date handling library

Post by malte » Wed Jul 03, 2013 10:19 pm

Implemented. This brings some other low hanging fruits, which I will be adding before the next release.

Cheers,

Malte

wilstrand
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 114
Joined: Mon Jan 03, 2011 3:02 pm
Contact:

Re: Start of a date handling library

Post by wilstrand » Wed Jul 03, 2013 10:46 pm

Malte!

This is really really nice! A very elegant function! Can't wait for the rest of the fruit party!

I will build a calendar widget now using rGrid and integrate it into rIDE.

Thanks again for your fine work!

Mats
http:www.tapirsoft.on-rev.com
Open Source LiveCode Plugins - rIDE, rGrid, rTree
LiveCode projects

malte
Posts: 1098
Joined: Thu Feb 23, 2006 8:34 pm
Location: Ostenfeld germany
Contact:

Re: Start of a date handling library

Post by malte » Wed Jul 03, 2013 11:10 pm

Your welcome. I just updated the library in the first post of this thread.

Best,

Malte

malte
Posts: 1098
Joined: Thu Feb 23, 2006 8:34 pm
Location: Ostenfeld germany
Contact:

Re: Start of a date handling library

Post by malte » Thu Jul 04, 2013 6:05 pm

I got a strange report that libDate would error out for the dateRange of the ISO Week (libDate_DaysOfCalendarWeekIso) does anybody else see this?

Best,

Malte

mimu
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 40
Joined: Tue Mar 05, 2013 7:00 pm
Location: Berlin
Contact:

Re: Start of a date handling library

Post by mimu » Sun Dec 15, 2013 11:56 pm

Hello Malte,
thank you very much for your great work on the date handling lib.

Do you have any idea how to get the the number of workingdays between 2 dates?

Ok, for beeing perfect it would be necessary to use an extra lookuptable for free extra days and holidyas, but it would be very helpful only to exclude saturday and sunday on demand in the calculation of libDate_DaysBetween.

Cheers Michael

malte
Posts: 1098
Joined: Thu Feb 23, 2006 8:34 pm
Location: Ostenfeld germany
Contact:

Re: Start of a date handling library

Post by malte » Thu May 01, 2014 11:53 am

Hi Michael,

sorry I did not see your reply earlier. Been a tad bit busy over here. :-D
The problem with this is that hollidays differ very much between different locations. If I look at germany alone, we have 16 different holliday calendars for the different regions. So what would need to be implemented would be a lookup table for hollidays in your region. Doable, but also a moving target. It is relatively simple to account for most christian hollidays (I got that in place in a project and might move that into the lib). But for other hollidays I can not see a way around some sort of lookup table. Sat and Sun would be trivial though.

Best,

Malte

malte
Posts: 1098
Joined: Thu Feb 23, 2006 8:34 pm
Location: Ostenfeld germany
Contact:

Re: Start of a date handling library

Post by malte » Sat Aug 02, 2014 12:55 am

I have put quite some work into the lib. The zipped stack is attached to the first post of this thread.


There is still quite a bit to do, however it is worth downloading the update:
Handler and Function names have been cleaned up. Also a parser has been added to finally get rid of the convert command as good as possible. I need your help now! I would like to add parsing for as many different languages I can get.

If you are using operating systems set to languages other than english, swedish or german, could you please be so kind to post:

the system dateFormat
the long system dateFormat
the abbrev system dateFormat
the system monthNames
the abbrev system monthNames
the system weekDayNames
the abbrev system weekDayNames

on your machines, along with the language you are using on your system and if possible the ISO code for that language? That would be a great help!


Be well,

Malte

ludo
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 66
Joined: Mon Dec 03, 2007 6:10 pm

Re: Start of a date handling library

Post by ludo » Sat Aug 02, 2014 1:01 pm

malte wrote:If you are using operating systems set to languages other than english, swedish or german, could you please be so kind to post:
From french OSX 10.9 system :
the system dateFormat : %d/%m/%Y
the long system dateFormat : %A %#d %B %Y
the abbrev system dateFormat : %a %#d %b %Y
the system monthNames :
janvier
février
mars
avril
mai
juin
juillet
août
septembre
octobre
novembre
décembre


the abbrev system monthNames :
janv.
févr.
mars
avr.
mai
juin
juil.
août
sept.
oct.
nov.
déc.


the system weekDayNames :
dimanche
lundi
mardi
mercredi
jeudi
vendredi
samedi

the abbrev system weekDayNames :
dim.
lun.
mar.
mer.
jeu.
ven.
sam.


on your machines, along with the language you are using on your system and if possible the ISO code for that language? That would be a great help!
iso code (639-1, 639-2, 639-3) : fr, fre/fra,fra

malte
Posts: 1098
Joined: Thu Feb 23, 2006 8:34 pm
Location: Ostenfeld germany
Contact:

Re: Start of a date handling library

Post by malte » Sun Aug 03, 2014 4:07 pm

Merci beaucoup!

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1760
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: Start of a date handling library

Post by [-hh] » Sun Aug 03, 2014 6:07 pm

..........
Last edited by [-hh] on Wed Aug 13, 2014 4:03 pm, edited 1 time in total.
shiftLock happens

malte
Posts: 1098
Joined: Thu Feb 23, 2006 8:34 pm
Location: Ostenfeld germany
Contact:

Re: Start of a date handling library

Post by malte » Mon Aug 04, 2014 8:44 am

Hi Herrmann,

vielen Dank!

%#y seems to be a new placeholder in the engine then. I wonder what for though. It used to be %y for a two digit year and %Y for a four digit year. The question is what LC 7 now means with %#y...

What do you get for: put the short english year?

All the best,

Malte

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1760
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: Start of a date handling library

Post by [-hh] » Mon Aug 04, 2014 2:18 pm

..........
Last edited by [-hh] on Wed Aug 13, 2014 4:03 pm, edited 1 time in total.
shiftLock happens

Post Reply

Return to “Extending LiveCode”