Repository navigation
format() learns the time of day.
npm install jalali-date@1.6.0
Time identifiers
| Identifier | Output |
|---|---|
H / HH |
hour, 24-hour clock (9 / 09) |
h / hh |
hour, 12-hour clock, 12 at noon and midnight |
m / mm |
minute |
s / ss |
second |
Z |
UTC offset, +03:30 |
new JDate(new Date(2017, 10, 17, 14, 5)).format('YYYY/MM/DD HH:mm Z') //=> 1396/08/26 14:05 +03:30These only format: they read the local time off the underlying Date and do no time arithmetic. An instance built from a Jalali date formats as midnight. persianNumerical applies to the new identifiers as well as the date ones.
Behaviour change
H, h, m, s and Z are now identifiers, so literal text containing them needs square brackets. format('yyyy mm') used to pass through unchanged and now prints minutes for mm; write format('yyyy [mm]') to keep the old output.
Bug fixes
- The instance
toGregorian()now keeps the existing time of day, sosetFullYear(),setMonth()andsetDate()no longer reset the time to midnight.
Development
108 tests pass, lint is clean, and test:types, test:bundles and test:exports pass against a fresh build.
lib/jdate.min.js is 7,351 bytes, up from 6,756.
Full changelog: 1.5.0...1.6.0