import { storiesOf, html } from '@open-wc/demoing-storybook'; import { css } from '@lion/core'; import { formatDate } from '../index.js'; const formatDateDemoStyle = css` .demo-table { border-collapse: collapse; text-align: right; } .demo-table thead > tr { border-bottom: 1px solid grey; } .demo-table thead > tr > :first-child, .demo-table tbody > tr > :first-child, .demo-table tfoot > tr > :first-child { text-align: left; } .demo-table th, .demo-table td { padding: 8px; } `; storiesOf('Localize System|Date', module).add( 'formatDate', () => html`
| Options | Code | Output |
|---|---|---|
| Default | formatDate(new Date()) |
${formatDate(new Date())} |
| Date display |
formatDate(new
Date(){weekday:'long',year:'numeric',month:'long',day:'2-digit'})
|
${formatDate(new Date(), { weekday: 'long', year: 'numeric', month: 'long', day: '2-digit', })} |
| Date without year |
formatDate(new Date(), {weekday:'long',month:'long',day:'2-digit'})
|
${formatDate(new Date(), { weekday: 'long', month: 'long', day: '2-digit', })} |
| Date without month |
formatDate(new Date(), {weekday:'long',year:'numeric',day:'2-digit'})
|
${formatDate(new Date(), { weekday: 'long', year: 'numeric', day: '2-digit', })} |
| Date without day |
formatDate(new Date(), {weekday:'long',year:'numeric',month:'long'})
|
${formatDate(new Date(), { weekday: 'long', month: 'long', year: 'numeric', })} |
| Locale | formatDate(new Date(){locale:'nl-NL'}) |
${formatDate(new Date(), { locale: 'nl-NL' })} |