npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@orenuki/dh-reporting-shared

v1.0.11

Published

Shared utilities for DH-Reporting app

Readme

DH-Reporting Shared Library

A shared utility library for the DH-Reporting mobile time tracking application. This package contains common functions, types, and constants used across the mobile and web applications.

📋 Overview

This shared library provides:

  • Validation functions for user input and business rules
  • Date/time utilities for work hours calculation and formatting
  • Business logic functions for time tracking and project management
  • Type definitions for common data structures
  • Constants for application-wide configuration

🚀 Quick Start

Installation

# For local development (from parent directory)
npm install ../dh-reporting-shared

# For published package (future)
npm install @dh-reporting/shared

Basic Usage

// Import validation functions
import { validateEmail, validateTimeEntry } from '@dh-reporting/shared';

// Import date utilities
import { formatWorkHours, calculateDuration } from '@dh-reporting/shared';

// Import types
import { User, Project, TimeEntry } from '@dh-reporting/shared';

// Import constants
import { APP_CONSTANTS, TIME_FORMATS } from '@dh-reporting/shared';

📁 Project Structure

src/
├── validation/          # Input validation functions
│   ├── userValidation.js
│   ├── timeValidation.js
│   └── projectValidation.js
├── utils/              # Utility functions
│   ├── dateUtils.js
│   ├── timeUtils.js
│   └── formatUtils.js
├── business-logic/     # Business rules and calculations
│   ├── timeCalculations.js
│   ├── projectLogic.js
│   └── overtimeRules.js
├── types/              # Type definitions
│   ├── commonTypes.js
│   ├── userTypes.js
│   └── projectTypes.js
├── constants/          # Application constants
│   ├── appConstants.js
│   ├── errorCodes.js
│   └── timeFormats.js
├── testing/            # Testing utilities
│   ├── testUtils.js
│   ├── mockData.js
│   └── testHelpers.js
└── index.js           # Main export file

🛠️ Available Functions

Validation Functions

import { validateEmail, validateEmployeeCode, validateTimeEntry } from '@dh-reporting/shared';

// Email validation
const isValidEmail = validateEmail('[email protected]'); // true/false

// Employee code validation  
const isValidCode = validateEmployeeCode('EMP001'); // true/false

// Time entry validation
const isValidEntry = validateTimeEntry({
  projectId: 'proj-123',
  date: '2024-01-15',
  duration: 480 // minutes
}); // true/false

Date/Time Utilities

import { formatWorkHours, calculateDuration, isBusinessDay } from '@dh-reporting/shared';

// Format work hours for display
const formatted = formatWorkHours(480); // "8.0 hours"

// Calculate duration between times
const duration = calculateDuration('09:00', '17:30'); // 510 minutes

// Check if date is a business day
const isBusiness = isBusinessDay(new Date()); // true/false

Business Logic Functions

import { calculateOvertime, validateWorkSchedule, getProjectProgress } from '@dh-reporting/shared';

// Calculate overtime hours
const overtime = calculateOvertime(dailyHours, 8); // hours over standard

// Validate work schedule
const isValid = validateWorkSchedule(timeEntries); // true/false

// Calculate project progress
const progress = getProjectProgress(timeEntries, allocatedHours); // percentage

🏗️ Development

Setup

# Clone the repository
git clone https://bitbucket.org/your-username/dh-reporting-shared.git
cd dh-reporting-shared

# Install dependencies
npm install

# Run tests
npm test

# Build the library
npm run build

Development Workflow

  1. Make changes to source files in src/
  2. Add tests for new functionality
  3. Run tests to ensure everything works: npm test
  4. Update version in package.json if needed
  5. Commit changes with descriptive commit messages
  6. Push to repository

Testing

# Run all tests
npm test

# Run tests in watch mode
npm run test:watch

# Run tests with coverage
npm run test:coverage

📦 Usage in Projects

Mobile App (dh-reporting-mobile)

// In React Native components
import { validateEmail, formatWorkHours } from '@dh-reporting/shared';

const SignUpScreen = () => {
  const handleEmailChange = (email) => {
    const isValid = validateEmail(email);
    // Handle validation result
  };
};

Web App (dh-reporting-web)

// In React components
import { calculateOvertime, getProjectProgress } from '@dh-reporting/shared';

const ProjectDashboard = () => {
  const progress = getProjectProgress(timeEntries, allocatedHours);
  // Display progress
};

🔄 Version Management

This library follows Semantic Versioning:

  • MAJOR version for incompatible API changes
  • MINOR version for backwards-compatible functionality additions
  • PATCH version for backwards-compatible bug fixes

Updating Consuming Apps

When updating the shared library:

# In mobile app
cd ../dh-reporting-mobile
npm install ../dh-reporting-shared

# In web app  
cd ../dh-reporting-web
npm install ../dh-reporting-shared

🧪 Testing Strategy

  • Unit tests for all validation functions
  • Integration tests for business logic
  • Mock data generators for testing consuming applications
  • Type checking for TypeScript compatibility

📋 Contributing

  1. Create a feature branch from develop
  2. Make your changes with appropriate tests
  3. Ensure all tests pass
  4. Update documentation if needed
  5. Create a pull request to develop
  6. Wait for code review and approval

📄 License

Private - Internal company use only

🔗 Related Repositories

📞 Support

For questions or issues related to the shared library:

  1. Check existing issues in the repository
  2. Create a new issue with detailed description
  3. Contact the development team for urgent matters

Built with ❤️ for the DH-Reporting time tracking system