Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

3 lat temu
123456789101112131415161718192021222324
  1. # ECMAScript Modules
  2. **date-fns** v2.x provides support for
  3. [ECMAScript Modules](http://www.ecma-international.org/ecma-262/6.0/#sec-modules)
  4. that enables tree-shaking for bundlers, like [rollup.js](http://rollupjs.org)
  5. and [webpack](https://webpack.js.org).
  6. If you have tree-shaking enabled in your bundler, just import functions normally:
  7. ```javascript
  8. import { format, parse } from 'date-fns'
  9. import { enUS, eo } from 'date-fns/locale'
  10. import { addDays, addHours } from 'date-fns/fp'
  11. ```
  12. In TypeScript, now you can import individual functions in more idiomatic way:
  13. ```typescript
  14. // Before
  15. import * as format from 'date-fns/format'
  16. // Now
  17. import format from 'date-fns/format'
  18. ```