A tiny (349B) reusable date formatter. Extremely fast!
Allow custom patterns (#7, #8): 65a64e5
You may optionally add new patterns or override existing patterns through tinydate
's second parameter. You will still receive a render function – now with your customized functionality!
Important: Each item of your custom dictionary must be a function~!
const today = new Date('2019-07-04, 5:30:00 PM');
// Example custom dictionary:
// - Adds {MMMM}
// - Overrides {DD}
const stamp = tinydate('Today is: {MMMM} {DD}, {YYYY}', {
MMMM: d => d.toLocaleString('default', { month: 'long' }),
DD: d => d.getDate()
});
stamp(today);
//=> 'Today is: July 4, 2019'
devDepdencies
versions: fa606ab