arshaw / xdate

A Modern JavaScript Date Library
http://arshaw.com/xdate/
GNU General Public License v2.0
681 stars 81 forks source link

Escape format characters #11

Closed tute closed 11 years ago

tute commented 12 years ago

Hi! How can we escape format characters? I've already got translated month names, but can't escape the second d:

new XDate().toString('d de MMMM') // "27 27e Abril"
new XDate().toString('d \de MMMM') // "27 27e Abril"

How can I create "27 de Abril"?

Thanks for your library!

janicki commented 12 years ago

Found the answer in a previous issue:

... enclose your literal text in single quotes to make sure xdate doesn't confuse it for formatting characters...