How to Get First And Last Day of Current Month in Moment Js?

Jan 20, 2023 . Admin

In this post, we will learn moment js get first and last day of current month. step by step explain startof method using moment js. you will learn endof method using moment js. if you want to see example of moment js get last date of month example then you are a right place. You just need to some step to done using moment js in react native.

In this example, We will get to last and first date to current month in react can easy and simply moment.js in react native.below's this example.

Step 1: Download Project

In the first step run the following command to create a project.

expo init ExampleApp
Step 2: Install library

Install moment.js by running the following command in your project:

npm install moment --save
Step 3: App.js

In this step, You will open the App.js file and put the code.

import React,{useState} from 'react';
import { StyleSheet, Text, View} from 'react-native';
import moment from 'moment'

export default function App() {
    return (
      <View style={styles.container}>
        <Text style={}>Start Date Current Month</Text>
        <Text style={}>{moment().startOf('month').format('YYYY-MM-DD hh:mm') }</Text>
        <Text style={}>End Date Current Month</Text>
        <Text style={}>{moment().endOf('month').format('YYYY-MM-DD hh:mm') }</Text>

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',

  text: {
    fontSize: 24,
  date: {
    fontSize: 24,
    fontWeight: 'bold',
    padding: 15

Step 4: Run Project

In the last step run your project using the below command.

expo start

You can QR code scan in Expo Go Application on mobile.


It will help you...

#React Native