I'm using Moment.js and React Native to display/manipulate date and time in the following fashion but can't quite seem to use it correctly. The code below demonstrates my usage of the library.
import * as React from 'react';import { Text, View, StyleSheet } from 'react-native';import Constants from 'expo-constants';import * as moment from 'moment';import { Card } from 'react-native-paper';interface event { title: string, created: any, expiration: any}const party : event = { title: '21st Bday Party', created: moment('2019 03 14'), expiration: moment('2019 03 15')}export default function App() { return (<View style={styles.container}><Card><Text>{party.created.format()}</Text></Card></View> );}const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', paddingTop: Constants.statusBarHeight, backgroundColor: '#ecf0f1', padding: 8, },});
I get the following error: TypeError: moment is not a function. What am I doing wrong? How can this issue be resolved?