diff --git a/Readme.md b/Readme.md index 95552f9..97e1168 100644 --- a/Readme.md +++ b/Readme.md @@ -135,15 +135,9 @@ e.g. `%q` becomes `q`. Use `%%` to get a literal `%` sign. of UTC and a minus sign for those west of UTC, hours and minutes follow each padded to 2 digits and with no delimiter between them -For more detail see `man 3 strftime` as the format specifiers should behave -identically. If behaviour differs please [file a bug](https://github.com/samsonjs/strftime/issues/new). +For more detail see `man 3 strftime` as the format specifiers should behave identically. If behaviour differs please [file a bug](https://github.com/samsonjs/strftime/issues/new). -Any specifier can be modified with `-`, `_`, `0`, or `:` as well, as in Ruby. -Using `%-` will omit any leading zeroes or spaces, `%_` will force spaces -for padding instead of the default, and `%0` will force zeroes for padding. -There's some redundancy here as `%-d` and `%e` have the same result, but it -solves some awkwardness with formats like `%l`. Using `%:` for time zone offset, -as in `%:z` will insert a colon as a delimiter. +Any specifier can be modified with `-`, `_`, `0`, or `:` as well, as in Ruby. Using `%-` will omit any leading zeroes or spaces, `%_` will force spaces for padding instead of the default, and `%0` will force zeroes for padding. There's some redundancy here as `%-d` and `%e` have the same result, but it solves some awkwardness with formats like `%l`. Using `%:` for time zone offset, as in `%:z` will insert a colon as a delimiter. Contributors ============ diff --git a/strftime.js b/strftime.js index 184f1d8..21b181a 100644 --- a/strftime.js +++ b/strftime.js @@ -79,7 +79,7 @@ d = undefined; } if (locale) { - deprecationWarning("`" + _require + "(format, [date], [locale])`", _require + ".localize(locale)(format, [date])"); + deprecationWarning("`" + _require + "(format, [date], [locale])`", "var s = " + _require + ".localize(locale); s(format, [date])"); } var strftime = locale ? defaultStrftime.localize(locale) : defaultStrftime; return strftime(fmt, d); @@ -88,7 +88,7 @@ adaptForwards(deprecatedStrftime); function deprecatedStrftime(fmt, d, locale) { if (locale) { - deprecationWarning("`" + _require + ".strftime(format, [date], [locale])`", _require + ".localize(locale)(format, [date])"); + deprecationWarning("`" + _require + ".strftime(format, [date], [locale])`", "var s = " + _require + ".localize(locale); s(format, [date])"); } else { deprecationWarning("`" + _require + ".strftime(format, [date])`", _require + "(format, [date])"); @@ -105,10 +105,10 @@ } if (locale) { - deprecationWarning("`" + _require + ".strftimeTZ(format, date, locale, tz)`", _require + ".timezone(tz).localize(locale)(format, [date])"); + deprecationWarning("`" + _require + ".strftimeTZ(format, date, locale, tz)`", "var s = " + _require + ".localize(locale).timezone(tz); s(format, [date])` or `var s = " + _require + ".localize(locale); s.timezone(tz)(format, [date])"); } else { - deprecationWarning("`" + _require + ".strftimeTZ(format, date, tz)`", _require + ".timezone(tz)(format, [date])"); + deprecationWarning("`" + _require + ".strftimeTZ(format, date, tz)`", "var s = " + _require + ".timezone(tz); s(format, [date])` or `" + _require + ".timezone(tz)(format, [date])"); } var strftime = (locale ? defaultStrftime.localize(locale) : defaultStrftime).timezone(timezone); @@ -118,10 +118,10 @@ var utcStrftime = defaultStrftime.utc(); function deprecatedStrftimeUTC(fmt, d, locale) { if (locale) { - deprecationWarning("`" + _require + ".strftimeUTC(format, date, locale)`", _require + ".localize(locale).utc()(format, [date])"); + deprecationWarning("`" + _require + ".strftimeUTC(format, date, locale)`", "var s = " + _require + ".localize(locale).utc(); s(format, [date])"); } else { - deprecationWarning("`" + _require + ".strftimeUTC(format, [date])`", _require + ".utc()(format, [date])"); + deprecationWarning("`" + _require + ".strftimeUTC(format, [date])`", "var s = " + _require + ".utc(); s(format, [date])"); } var strftime = locale ? utcStrftime.localize(locale) : utcStrftime; return strftime(fmt, d);