Co-authored-by: Mikhail Bashkirov <mikhail.bashkirov@ing.com> Co-authored-by: Thijs Louisse <thijs.louisse@ing.com> Co-authored-by: Joren Broekema <joren.broekema@ing.com> Co-authored-by: Gerjan van Geest <gerjan.van.geest@ing.com> Co-authored-by: Erik Kroes <erik.kroes@ing.com> Co-authored-by: Lars den Bakker <lars.den.bakker@ing.com>
803 B
803 B
Date
The date formatter returns a date based on the locale by using Intl DateTimeFormat specification.
Features
- formatDate: returns a formatted date based on locale
- parseDate: returns a date Object
- getDateFormatBasedOnLocale: returns the date format based on locale
How to use
Installation
npm i --save @lion/localize;
Example
import { parseDate, formatDate } from '@lion/localize';
function dateExampleFunction () {
const parsedDate = parseDate('21-05-2012');
const options = {
weekday: 'long', year: 'numeric', month: 'long', day: '2-digit',
};
return formatDate(parsedDate, options) // 'Monday, 21 May 2012' for British locale
}