Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: Thomas 'PointedEars' Lahn Newsgroups: comp.lang.javascript Subject: Re: need to evaluate and store a mustache variable for a date function Date: Sun, 30 Nov 2014 17:45:44 +0100 Organization: PointedEars Software (PES) Lines: 42 Message-ID: <2856755.Lea29hFERk@PointedEars.de> References: Reply-To: Thomas 'PointedEars' Lahn Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit X-Trace: solani.org 1417365946 717 eJwFwYEBgDAIA7CXZKXAzkGk/59gQoTFpAfDKeqMmWyK+XQ78lziwjRbegsLmZOlDMW33j8NohDf (30 Nov 2014 16:45:46 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Sun, 30 Nov 2014 16:45:46 +0000 (UTC) User-Agent: KNode/4.14.2 X-User-ID: eJwNyskBwDAIA7CVSAFTxok59h+h1VuuOKgwOMzXN5+DZnSe9NIZTFJGoDfkYUQza50QMiFrf7gIleoxvIYPV4YVow== Cancel-Lock: sha1:eLG4unJiMpWDQeAwSivCHXn6iag= X-NNTP-Posting-Host: eJwFwQEBACAIA7BKoHIkjsrfP4JbTDheLgRWKNQ3nW8PDTttpI7PrWUlsFnMvih1moc5Gx85ghH3 Xref: csiph.com comp.lang.javascript:26256 JRough wrote: > I need the date in another format than JSP and since I don't know Java I > would like it to be in javascript. I don't know how to store the Mustache > variable so I can input it into the date function? I need the filingDate > value from mustache as input into the date object. thanks, > > >
  • If “{{filingDate}}” expands to a number specifying the number of seconds or milliseconds since Epoch for that date, then you can use that approach (seconds would have to be multiplied by 1'000); otherwise, as we have determined recently [1], you SHOULD NOT. If “{{filingDate}}” expands to a string from which you can extract the month number, such as "2014-11-30", then you can assign, for example: var d = "{{filingDate}}"; and then use string methods to process the value of “d” (also discussed recently). However, it is likely that Mustache has a way to get to the information without client-side scripting; it would be better that way, unless you can make sure that client-side scripting and document.write() is supported with the user. Still, document.write() should be avoided as it slows down rendering of the document; tree-modifying methods introduced with the W3C DOM should be used instead. Mustache is off-topic here, though, as you have been told before. Please read and follow the recommendations in the FAQ. And get a real name. _______ [1] -- PointedEars FAQ: | SVN: Twitter: @PointedEars2 | ES Matrix: Please do not cc me. / Bitte keine Kopien per E-Mail.