Expand my Community achievements bar.

Today's date (formatted) as the default datetime field


Level 3

Working with LC ES2 yet.

The datetime field has the following patterns:

display: date{D de 'MMMM' de 'YYYY}

edit: date{DD/MM/YYYY}

data: date{DD/MM/YYYY}

Well, I need to assign the current date as default, in this no problem, I can do:

--- ...:: ready: layout ---

if (this.rawValue == null) {

  this.rawValue = util.printd ("dd / mm / yyyy", new Date ());


I need to show to user the formatted date "of hmm xx of yyyy" (as indicate display pattern), but at the same time, the XML data is stored as "xx/mm/yy" (as indicate the data pattern).

The problem is as follows:

+ If the value is assigned by code, the datetime field does NOT apply the pattern "display" and shows literally "dd/mm/yyyy".

+ I also explicitly assign the date in the correct format, but in that case if I examine the resulting XML, what you get is the formatted date you've assigned (and no date pattern format).

So the question is how can I assign a default (via code) and Reader interpret / apply the display format (as it does when the user selects the calendar date)?

I appreciate any suggestion, greetings.Today's date (formatted) as the default datetime field

0 Replies