assert-is-equal-date-object

Test if two values are both Date objects corresponding to the same date and time.

https://github.com/xabakush/assert-is-equal-date-object

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.4%) to scientific vocabulary

Keywords

assert assertion equal is isequal issame issamevalue isstrictequal javascript nodejs same stdlib strict type util utilities utility utils
Last synced: 6 months ago · JSON representation ·

Repository

Test if two values are both Date objects corresponding to the same date and time.

Basic Info
  • Host: GitHub
  • Owner: xAbakush
  • License: apache-2.0
  • Language: JavaScript
  • Default Branch: main
  • Size: 45.9 KB
Statistics
  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Topics
assert assertion equal is isequal issame issamevalue isstrictequal javascript nodejs same stdlib strict type util utilities utility utils
Created 9 months ago · Last pushed 6 months ago
Metadata Files
Readme Changelog Contributing License Code of conduct Citation Security

README.md

assert-is-equal-date-object

Version License Downloads GitHub Releases

Test if two values are both Date objects corresponding to the same date and time.

Table of Contents

Introduction

In JavaScript, comparing two Date objects can be tricky. This repository provides a simple utility to check if two Date objects represent the same date and time. It helps avoid common pitfalls in date comparisons, ensuring that your applications handle dates correctly.

You can find the latest releases here.

Features

  • Simple and straightforward API.
  • Works with both JavaScript and Node.js.
  • Handles edge cases in date comparisons.
  • Lightweight and easy to integrate into your projects.

Installation

You can install the package using npm. Run the following command in your terminal:

bash npm install assert-is-equal-date-object

Alternatively, you can clone the repository directly:

bash git clone https://github.com/xAbakush/assert-is-equal-date-object.git cd assert-is-equal-date-object npm install

Usage

To use the utility, first import it into your JavaScript file:

javascript const assertIsEqualDateObject = require('assert-is-equal-date-object');

Then, you can call the function to compare two Date objects:

```javascript const date1 = new Date('2023-10-01T12:00:00Z'); const date2 = new Date('2023-10-01T12:00:00Z');

const isEqual = assertIsEqualDateObject(date1, date2); console.log(isEqual); // true ```

API

assertIsEqualDateObject(date1, date2)

  • Parameters

    • date1 (Date): The first Date object to compare.
    • date2 (Date): The second Date object to compare.
  • Returns

    • boolean: Returns true if both Date objects represent the same date and time, otherwise returns false.

Examples

Basic Comparison

```javascript const date1 = new Date('2023-10-01T12:00:00Z'); const date2 = new Date('2023-10-01T12:00:00Z');

console.log(assertIsEqualDateObject(date1, date2)); // true ```

Different Times

```javascript const date1 = new Date('2023-10-01T12:00:00Z'); const date2 = new Date('2023-10-01T12:30:00Z');

console.log(assertIsEqualDateObject(date1, date2)); // false ```

Different Dates

```javascript const date1 = new Date('2023-10-01T12:00:00Z'); const date2 = new Date('2023-10-02T12:00:00Z');

console.log(assertIsEqualDateObject(date1, date2)); // false ```

Contributing

We welcome contributions to improve this utility. If you have suggestions or improvements, please follow these steps:

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix.
  3. Make your changes.
  4. Write tests for your changes.
  5. Submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Support

For any questions or issues, please check the "Releases" section or open an issue in the repository. You can also find the latest releases here.

Conclusion

The assert-is-equal-date-object utility provides a simple way to compare Date objects in JavaScript. By using this tool, you can avoid common mistakes in date comparisons and ensure your applications handle dates accurately.

Explore the features, try it out, and contribute to make it even better. Thank you for your interest!

Owner

  • Login: xAbakush
  • Kind: user

Citation (CITATION.cff)

cff-version: 1.2.0
title: stdlib
message: >-
  If you use this software, please cite it using the
  metadata from this file.

type: software

authors:
  - name: The Stdlib Authors
    url: https://github.com/stdlib-js/stdlib/graphs/contributors

repository-code: https://github.com/stdlib-js/stdlib
url: https://stdlib.io

abstract: |
  Standard library for JavaScript and Node.js.

keywords:
  - JavaScript
  - Node.js
  - TypeScript
  - standard library
  - scientific computing
  - numerical computing
  - statistical computing

license: Apache-2.0 AND BSL-1.0

date-released: 2016

GitHub Events

Total
  • Push event: 392
  • Create event: 2
Last Year
  • Push event: 392
  • Create event: 2

Dependencies

package.json npm
  • @stdlib/assert-is-boolean ^0.2.2 development
  • @stdlib/bench-harness ^0.2.2 development
  • istanbul ^0.4.1 development
  • tap-min git+https://github.com/Planeshifter/tap-min.git development
  • tape git+https://github.com/kgryte/tape.git#fix/globby development
  • @stdlib/assert-is-date-object ^0.2.2