This package has been deprecated

Author message:

@1.0.10

meridiem

1.0.10 • Public • Published

meridiem

What is it?

A utility library that:

  1. Retrieves military, 12 hr, and 24 hr representations of all times in the day, by an interval of your choice (>= 1 minute)
  2. Maps a military or 24 hr time to its respective 12 hr time with proper meridiem (AM/PM)
  3. Retrieves an ordered list of all times of the day, by an interval of your choice (minimum 1 minute)

Usage (node)

  1. Require the Meridiem module
  2.   
      var Meridiem = require('meridiem');
      
    

    This returns a constructor which we can create new Meridiem objects from

  3. Create a new Meridiem & initialize by any interval of minutes <= 60 (default = 1)
  4.   
      var intervalsOf1 = new Meridiem(1);
      
    

    Note: This returns a map of all times in a day at specified interval of minutes

      
      {
        '1000': {
          military: '1000',
          twelveHr: '10:00 AM',
          twentyFourHr: '10:00'
        },
       '1001': {
         military: '1001',
         twelveHr: '10:01 AM',
         twentyFourHr: '10:01'
        },
       ....
      }
      
    
  5. Access a time object by passing a String as a key. The string can even have a ':'; it's up to you
  6.   
      //by string key
      var tenPM = intervalsOf1.get('2200');
      var threeThirtyNineAM = intervalsOf1.get('03:39');
      
    

    This returns an object, with 12hr, 24hr and military representations of the specified time

      
        { military: '2200', twelveHr: '10:00 PM', twentyFourHr: '22:00' }
      
    
  7. Get an ordered list of all times of the day, by an interval of your choice (>= 1 minute)
  8. intervalsOf1List = intervalsOf1.getList();

    This returns an ordered list of all times in the day at specified interval of minutes

      
      [
        { military: '0000', twelveHr: '12:00 AM', twentyFourHr: '00:00' },
        { military: '0001', twelveHr: '12:01 AM', twentyFourHr: '00:01' },
        ...
      ]
      
    

Package Sidebar

Install

npm i meridiem

Weekly Downloads

4

Version

1.0.10

License

ISC

Last publish

Collaborators

  • nikhilwins