1.0.3 • Published 6 years ago

months-to-years v1.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
6 years ago

months-to-years

This library will convert the number of months into years and years into months

NPM JavaScript Style Guide

Install

npm install --save months-to-years

Usage

This library has below two component that returns number of months and years.

ToYearsComponent - This component expect months and returns Years.
ToMonthsComponent - This component expect years and returns month.
import React, { Component } from 'react'

import {ToYearsComponent, ToMonthsComponent} from 'months-to-years'

export default class App extends Component {
  render () {
    return (
      <div>
        <h1> Months to Years </h1><br />
        <ToYearsComponent months='35' /> Output: 2 years 11 months 
        <ToYearsComponent months='35' yearsText='Years' monthsText='Months' /> Output: 2 Years 11 Months
        <ToYearsComponent months='35' dotFormat={true} /> <br />Output: 2.11
        <h1> Years to Months</h1><br />
        <ToMonthsComponent years='3.1' /> Output: 37 months
        <ToMonthsComponent years='3.9' monthsText='Months'/> Output : 45 Months
        <ToMonthsComponent years='2' monthsText='MM' /> Output: 24 MM
        <ToMonthsComponent years='5' /> <br /> Output: 60 months
      </div>
    )
  }
}
1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago