Agreed, DHTML calendar is pretty close to what SQL uses for date formatting, I would suggest sticking to an existing standard rather than creating a new one.

Colin

Fabian Lange wrote:

Hello,

Have you considered aligning it with DHTML calendar?

http://www.dynarch.com/projects/calendar/

when you have adopted what that guy does you get perhaps a bigger client base. I know many projects using it because it does everything what is needed. Especially it has a mechanism for the formatting

 

.: Fabian

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Gareth Evans
Sent: Dienstag, 13. März 2007 21:04
To: [email protected]
Subject: [Rails-spinoffs] Re: [ANN] DatePicker v0.9.1

 

While it may be implied, it's also best said:

 

The placeholder hash should contain more than just MM, YYYY and D. It should also contain all the other date part constants- YY for 2 digit year, MMM for short date etc.

There are many different implementations here, you can keep your code tidy by storing the placeholders and the resulting values for each of the calculations in the hash in my earlier example.

 

Feel free to interchange as you see fit, I tried to keep with a scheme

 

m Month as non zero padded number 2

mm Month as a decimal no, zero padded. 02
M Abbreviated month name Feb
MM Full month name February
dd Day as number, zeropadded (08)

d Day of the month (23)
y Day of the year (54)
yy Year without century (98)
yyyy Year with century (1998)
w Weekday (5 (0 is Sunday))

ww Week of year (45)
a Abbreviated day name Fri
A Weekday Name Friday

q Quarter (1)


 

On 3/14/07, Mathieu Jondet <[EMAIL PROTECTED]> wrote:


Gareth Evans wrote:
> To get around the concerns of having to specify the locale why don't we
> specify a date-format string which has a number of replaces performed on it.
> That way, you can just specify the return format, aside from the locale.
> If the users application wants * as a seperator, then they can specify it.
>
> For example (this is psudeocode / half vb [for the date stuff] half js
> [for the prototype stuff])
> I may have used hash incorrectly, but you should get the drift
>
> placeholders_hash -> { 'MM': month(currentDate), 'YYYY':
> year(currentdate), 'YY': substr(year(currentdate),2), 'D':
> day(currentdate) }
> formatString = 'D/MM/YYYY'
> var outputString = formatString;
> placeholders_hash.each(function (key,value) {
> outputString = replace(outputString,key,value) });
> alert(outputString);
>
> Then by changing formatString, you can control the order, the parts
> used, the seperator etc.
> You could make it iso compliant by passing YYYY-MM-DD (assuming all of
> those placeholders were in the hash)
>
> Just an idea...


Hi Gareth,
ok, I'll will work on this type of approach to give more power to the
user for formatting the date, thanks for the input.
In the meantime I just released an minor update to the initial release
v0.9.1 :
http://www.eulerian.com/en/opensource/datepicker-prototype-scriptaculous
Here is the ChangeLog :
- replace locale by language (RobG)
- add support for german language (Kjell Bublitz)
- add support for portuguese language
- use Prototype.emptyFunction when clickCallBack not defined, should
fix possible bug with IE and null objects (Gareth Evans)
- some code clean-up using Builder.node

Regards,
Mathieu
<br




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to