Skip to content

hbiede/react-native-date-i18n

react-native-date-i18n

A React Native library to handle localizing date objects to the user's device settings

Installation

# Using yarn
yarn add react-native-date-i18n

# Using npm
npm install react-native-date-i18n

Usage

import {
  DateType,
  formatDate,
  formatTime,
  formatDateTime,
  formatAbbreviatedShortDate,
  formatAbbreviatedShortDateRange,
  formatAbbreviatedShortTime,
  formatAbbreviatedShortTimeRange
} from 'react-native-date-i18n';

formatDate(testDate, DateType.long);
formatTime(testDate, DateType.medium);
formatDateTime(testDate, DateType.full, DateType.short);
formatAbbreviatedShortDate(testDate);
formatAbbreviatedShortDateRange(testDate, testDate2);
formatAbbreviatedShortTime(testDate);
formatAbbreviatedShortTimeRange(testDate, testDate2);

The DateType options map onto values of the same names across both operating systems:

Screenshots

First demonstration of possible outputs Second demonstration of possible outputs

Contributing

License

MIT


Made with create-react-native-library

About

A React Native library to handle localizing date objects to the user's device settings

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

No packages published