Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Tutitoos/util-tiempo
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.0.45
Choose a base ref
...
head repository: Tutitoos/util-tiempo
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
  • 15 commits
  • 18 files changed
  • 2 contributors

Commits on Jul 9, 2023

  1. Copy the full SHA
    4df14aa View commit details
  2. Copy the full SHA
    8d43c34 View commit details
  3. Update version to 1.0.46

    Tutitoos committed Jul 9, 2023
    Copy the full SHA
    0df20ba View commit details

Commits on Jul 10, 2023

  1. Copy the full SHA
    6ac0b54 View commit details
  2. Merge pull request #15 from Tutitoos/renovate/nodemon-3.x

    Update dependency nodemon to v3
    Tutitoos authored Jul 10, 2023
    Copy the full SHA
    04cb1d5 View commit details
  3. Add file tests functions

    Tutitoos committed Jul 10, 2023
    Copy the full SHA
    44da3db View commit details
  4. Copy the full SHA
    e4763ab View commit details

Commits on Jul 23, 2023

  1. Copy the full SHA
    1319545 View commit details
  2. Copy the full SHA
    0f05560 View commit details
  3. Copy the full SHA
    2228916 View commit details
  4. Copy the full SHA
    6c0a4d8 View commit details
  5. Fix bugs

    Tutitoos committed Jul 23, 2023
    Copy the full SHA
    72e4b83 View commit details
  6. Copy the full SHA
    44079dc View commit details
  7. Copy the full SHA
    b51c499 View commit details

Commits on Jun 15, 2024

  1. Set up CI with Azure Pipelines

    [skip ci]
    Tutitoos committed Jun 15, 2024
    Copy the full SHA
    820b18f View commit details
Showing with 367 additions and 139 deletions.
  1. +21 −21 .eslintrc.cjs → .eslintrc.json
  2. +2 −0 .npmignore
  3. +21 −0 azure-pipelines.yml
  4. +23 −44 package-lock.json
  5. +4 −3 package.json
  6. +11 −2 src/Validate.ts
  7. +3 −2 src/index.ts
  8. +1 −1 src/lib/get.ts
  9. +1 −2 src/lib/getCompareDate.ts
  10. +1 −2 src/lib/getFormatDate.ts
  11. +1 −1 src/lib/getMs.ts
  12. +5 −1 src/lib/getNextTime.ts
  13. +1 −9 src/lib/index.ts
  14. +47 −0 src/{types/global.d.ts → types.d.ts}
  15. +0 −48 src/types/index.d.ts
  16. +31 −1 src/util.ts
  17. +191 −0 tests.cjs
  18. +3 −2 tsconfig.json
42 changes: 21 additions & 21 deletions .eslintrc.cjs → .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
module.exports = {
env: {
es2021: true,
node: true,
{
"env": {
"es2021": true,
"node": true
},
extends: ["xo", "prettier"],
plugins: ["import"],
overrides: [
"extends": ["xo", "prettier"],
"plugins": ["import"],
"overrides": [
{
extends: ["xo-typescript", "prettier"],
files: ["*.ts", "*.tsx"],
rules: {
"extends": ["xo-typescript", "prettier"],
"files": ["*.ts", "*.tsx"],
"rules": {
"import/first": "error",
"import/no-duplicates": "error",
"no-duplicate-imports": "error",
"no-implicit-coercion": "off",
"no-unused-vars": ["error"],
"@typescript-eslint/consistent-type-definitions": [
"error",
"interface",
"interface"
],
"@typescript-eslint/indent": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/no-extraneous-class": "off",
"guard-for-in": "off",
},
},
"guard-for-in": "off"
}
}
],
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
rules: {
"rules": {
"import/first": "error",
"import/no-duplicates": "error",
"no-duplicate-imports": "error",
"no-implicit-coercion": "off",
},
};
"no-implicit-coercion": "off"
}
}
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.editorconfig
.eslintrc.json
rome.json
tsconfig.json
renovate.json
node_modules/
src/
21 changes: 21 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Node.js
# Build a general Node.js project with npm.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript

trigger:
- main

pool:
vmImage: ubuntu-latest

steps:
- task: NodeTool@0
inputs:
versionSpec: '10.x'
displayName: 'Install Node.js'

- script: |
npm install
npm run build
displayName: 'npm install and build'
67 changes: 23 additions & 44 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "util-tiempo",
"version": "1.0.45",
"version": "1.0.52",
"description": "util-tiempo para calcular tiempos, para obtener la fecha a elegir, con muchas opciones!",
"author": "Tutitoos",
"license": "MIT",
@@ -28,11 +28,12 @@
"getFormatDate"
],
"main": "dist/index.js",
"types": "types/index.d.ts",
"types": "dist/index.d.ts",
"scripts": {
"build": "tsc",
"start": "node dist/index.js",
"dev": "ts-node-dev --respawn --transpile-only --poll src/index.ts",
"test": "node tests.cjs",
"lint": "npm run lint:rome && npm run lint:eslint",
"lint:rome": "rome check src",
"lint:eslint": "eslint --ignore-path .gitignore . --max-warnings 0",
@@ -46,7 +47,7 @@
"eslint-config-xo": "0.43.1",
"eslint-config-xo-typescript": "0.57.0",
"eslint-plugin-import": "2.27.5",
"nodemon": "2.0.22",
"nodemon": "3.0.1",
"ts-node-dev": "2.0.0",
"typescript": "5.1.6"
}
13 changes: 11 additions & 2 deletions src/Validate.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
import { type GetTime, type GetNextTime, type GetFormatDate, type GetDate, type GetCompareDate } from "./types";
import type { DateFormats, DateTypes, Locales, Timezones } from "./types/global";
import {
type GetTime,
type GetNextTime,
type GetFormatDate,
type GetDate,
type GetCompareDate,
type DateFormats,
type DateTypes,
type Locales,
type Timezones,
} from "./types";

class Validate {
/**
5 changes: 3 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env node

import utilTiempo from "./lib/index";
import * as utilTiempo from "./lib/index";

module.exports = utilTiempo;
export default utilTiempo;
export * from "./lib/index";
2 changes: 1 addition & 1 deletion src/lib/get.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Validate from "../Validate";
import type { DateTypes } from "../types/global";
import type { DateTypes } from "../types";
import { dateList } from "../util";

/**
3 changes: 1 addition & 2 deletions src/lib/getCompareDate.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Validate from "../Validate";
import type { GetCompareDateProps } from "../types";
import { type DateNameAliases } from "../types/global";
import type { GetCompareDateProps, DateNameAliases } from "../types";
import { compareDataParse, dateList } from "../util";

/**
3 changes: 1 addition & 2 deletions src/lib/getFormatDate.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Validate from "../Validate";
import type { GetFormatDateProps } from "../types";
import type { HourFormats, TimeFormats } from "../types/global";
import type { GetFormatDateProps, HourFormats, TimeFormats } from "../types";

/**
* Returns a formatted date string based on the provided options.
2 changes: 1 addition & 1 deletion src/lib/getMs.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Validate from "../Validate";
import type { DateTypes } from "../types/global";
import type { DateTypes } from "../types";
import { dateList } from "../util";

/**
6 changes: 5 additions & 1 deletion src/lib/getNextTime.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Validate from "../Validate";
import { type GetNextTimeProps } from "../types";
import { formatDateFromString } from "../util";
import getMs from "./getMs";
import getTime from "./getTime";

@@ -21,8 +22,11 @@ const getNextTime = (...options: Partial<GetNextTimeProps>): number => {
throw new Error("Invalid time format, must be HH:MM:SS");
}

// Get the current date in the specified timezone
const date = formatDateFromString(new Date().toLocaleString(local, { timeZone: timezone }));

// Get the current timestamp in the specified timezone
const timestamp = new Date(new Date().toLocaleString(local, { timeZone: timezone })).getTime();
const timestamp = new Date(date).getTime();

// Split the time into hour, minute, and second components
const [hour, minute, second] = getTime({
10 changes: 1 addition & 9 deletions src/lib/index.ts
Original file line number Diff line number Diff line change
@@ -6,12 +6,4 @@ import getMs from "./getMs";
import getTime from "./getTime";
import getNextTime from "./getNextTime";

export default {
get,
getCompareDate,
getDate,
getFormatDate,
getMs,
getTime,
getNextTime,
};
export { get, getCompareDate, getDate, getFormatDate, getMs, getTime, getNextTime };
Loading