Opened 14 years ago

Closed 13 years ago

Last modified 12 years ago

#636 closed defect (fixed)

2 different date formats (validation - formatting)

Reported by: Jan831 <jan831@…> Owned by: Adam Peller
Priority: high Milestone:
Component: General Version: 0.2
Keywords: Cc: peller@…
Blocked By: Blocking:

Description

dojo.validation.isValidDate(dateValue, "DD/MM/YYYY");
dojo.date.format(dateObject, "%d/%m/%Y");

they both use different format-notations (the strftime-format vs. the typical java-format). Isn't consistent and different to use, having 2 different formats for date-validation and date manipulation

Change History (9)

comment:1 Changed 14 years ago by Tom Trenka

Resolution: invalid
Status: newclosed

Date validation and date manipulation are two different things; validation works with a string representation, and date.format works with a Date object. While the formatting can be confusing it's still a valid approach to work with (no pun intended).

(note that the previous versions of date formatting that dojo.date.format replaced also used a different formatting scheme.)

comment:2 Changed 14 years ago by Jan831 <jan831@…>

Resolution: invalid
Status: closedreopened

I know date manipulation and date validation are 2 different things, but the presentation of date formats is a common for both actions. IMHO an application should stick to 1 presentation of date formats.

When working with dates in my app, I need to keep in mind to provide both date formats and to make conversions between them (not that easy when users can define their own formats)

All elements of the java-style format (YYYY, MM, ...) can easily be replaced by their strftime-format (%Y, %m, ...). dojo.validate.isValidDate is the only place where this java-style format is used, so it's not that difficult to replace it.

comment:3 Changed 13 years ago by dylan

Milestone: 0.5
Owner: changed from anonymous to dylan
Status: reopenednew

comment:4 Changed 13 years ago by dylan

Status: newassigned

comment:5 Changed 13 years ago by Adam Peller

Cc: peller@… added

dojo.date.format no longer takes posix-style strings (deprecated in 0.4) While dojo.date.strftime will continue to exist, the new Date parsing and formatting is moving towards Java-style patterns so that we can reuse the repository at unicode.org/cldr. So, when I get to the validation code, which is looking like 0.5, I plan to change it to just call out to the dojo.date.format module and use the Java formats, which are slightly different from what's in there today, but at least we'll have a single, common implementation.

comment:6 Changed 13 years ago by dylan

Owner: changed from dylan to Adam Peller
Status: assignednew

comment:7 Changed 13 years ago by Adam Peller

Milestone: 0.50.4

comment:8 Changed 13 years ago by Adam Peller

Resolution: fixed
Status: newclosed

(In [5919]) DateTextbox? uses dojo.date.parse; deprecate old usage. Fixes #636

comment:9 Changed 12 years ago by (none)

Milestone: 0.4

Milestone 0.4 deleted

Note: See TracTickets for help on using tickets.