[
https://issues.apache.org/jira/browse/TAPESTRY-2198?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12625226#action_12625226
]
Davor Hrg commented on TAPESTRY-2198:
-------------------------------------
here's a crazy thought:
server side could be used to do the conversions using ajax,
and by this inline perfectly with the SimpleDateFormat because
SimpleDateFormat would be actualy doing the hard work,
as tapestry will most likely have an js library abstraction
this can also be made replaceable by defining for example
Tapestry.formatDate(dateObj, formatStr) :: String
Tapestry.parseDate(dateStr, formatStr) :: Date
finally, an limited implementation of SimpleDateFormat
shouldn't be too hard
y - Year. 1x,2x,3x - year truncated to 2 digits, 4x+ - year padded with zeroes
if needed
M - Month
d - day of month
H - Hour (0-23)
k - Hour (1-24)
m - minute
s - seconds
a - AM,PM marker
numbers :
formatting: 1x - number, 2x+ - padded
parsing: number of digits is ignored unless there is no separator with
adjactent fields
I'm saying all this because I see my self using the js conversion only for the
DateField
component... and all the rest would be from server side...
> Date formating global support
> -----------------------------
>
> Key: TAPESTRY-2198
> URL: https://issues.apache.org/jira/browse/TAPESTRY-2198
> Project: Tapestry
> Issue Type: Improvement
> Affects Versions: 5.0.11
> Reporter: Davor Hrg
> Assignee: Howard M. Lewis Ship
>
> there is a javascript implementation of
> SimpleDateFormat and is apache 2.0 licensed
> http://www.timdown.co.uk/code/simpledateformat.php
> it implements most of:
> http://java.sun.com/j2se/1.5.0/docs/api/java/text/SimpleDateFormat.html
> It is 8.7 Kb with stripped comments.
> I'm looking at making a trimmed down version that can parse/format only
> numeric date parts : day, month, year, dour, min sec.
> This covers most likely usages on the client side (forms and datefield) and
> would make shorter code.
> (I feel that prototype is bloated already so another 10K does not look
> apealing)
> Not to complicate things and optimize too soon, full lib can be used now,
> and later along with "multiple js lib support" the short version should be
> made available and pushed as default.
> while talking about dates... date format should be in message catalog so it
> is locale specific.
> for example in my language date format is: dd.MM.yyyy
> there should be different keys for server side format and client side format
> (the formats should be compatible of course)
> tapestry-date-format-server=MM/dd/yyyy
> tapestry-date-format-js=MM/dd/yyyy
> (which are sam in case we use forementioned lib)
> or, if one would choose to use the former date picker i would be:
> tapestry-date-format-server=MM/dd/yyyy
> tapestry-date-format-js=%m.%d.%Y
> I feel strongly about this being global key instead parameter for
> datefield, but even if it is only for date-field there should be two formats
> (server and js)
> in the end... the formater should be used to test validity for the field on
> the client side
> or regexp added to message catalog
> tapestry-date-format-js-regex=...complex or simple regex......
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]