Skip to content

Commit

Permalink
v 0.0.3 to v 0.0.4
Browse files Browse the repository at this point in the history
v 0.0.4
  • Loading branch information
kry008 authored Nov 1, 2021
2 parents 986f7a4 + ac3a141 commit d2383a9
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 12 deletions.
6 changes: 5 additions & 1 deletion NEWs.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# ChangeLog
## 0.0.4
* Change from Math.random() to crypto library
* Add French [4]
## 0.0.3
* Small improving
* Add Russian [3]

* Demo added

## 0.0.2
* First public version
* NPM add
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Date Functions
GitHub:
![GitHub repo size](https://img.shields.io/github/repo-size/kry008/functions-date) ![GitHub closed issues](https://img.shields.io/github/issues-closed-raw/kry008/functions-date) ![GitHub pull requests](https://img.shields.io/github/issues-pr-raw/kry008/functions-date) ![GitHub package.json version](https://img.shields.io/github/package-json/v/kry008/functions-date) ![GitHub Repo stars](https://img.shields.io/github/stars/kry008/functions-date?style=social)
![GitHub repo size](https://img.shields.io/github/repo-size/kry008/functions-date) ![GitHub pull requests](https://img.shields.io/github/issues-pr-raw/kry008/functions-date) ![GitHub package.json version](https://img.shields.io/github/package-json/v/kry008/functions-date) ![GitHub Repo stars](https://img.shields.io/github/stars/kry008/functions-date?style=social)
Errors (Bugs): ![GitHub issues by-label](https://img.shields.io/github/issues/kry008/functions-date/Error)/![GitHub closed issues by-label](https://img.shields.io/github/issues-closed/kry008/functions-date/Errors)
New feature request: ![GitHub issues by-label](https://img.shields.io/github/issues/kry008/functions-date/New%20feature)

Expand Down
31 changes: 24 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const crypto = require("crypto");
const Data = new Date();
var language = 1;//0 - EN, 1 - PL, 2 - DE, 3 - RU
var debug = false;
Expand All @@ -7,16 +8,19 @@ dayOfWeek[0] = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday"
dayOfWeek[1] = ["Niedziela", "Poniedziałek", "Wtorek", "Środa", "Czwartek", "Piątek", "Sobota"];
dayOfWeek[2] = ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"];
dayOfWeek[3] = ["Воскресенье", "понедельник", "вторник", "среда", "четверг", "пятница", "суббота"];
dayOfWeek[4] = ["Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi"];
var monthOfWeek = []
monthOfWeek[0] = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
monthOfWeek[1] = ["Styczeń", "Luty", "Marzec", "Kwiecień", "Maj", "Czerwiec", "Lipiec", "Sierpień", "Wrzesień", "Październik", "Listopad", "Grudzień"];
monthOfWeek[2] = ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"];
monthOfWeek[3] = ["Январь", "Февраль", "Март", "Апрель", "Май", "Июнь", "Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", "Декабрь"];
monthOfWeek[4] = ["Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"];
var seasons_tab = [];
seasons_tab[0] = ["Spring", "Summer", "Autumn", "Winter"]
seasons_tab[1] = ["Wiosna", "Lato", "Jesień", "Zima"]
seasons_tab[2] = ["Frühling", "Sommer", "Herbst", "Winter"]
seasons_tab[3] = ["Весна", "лето", "осень", "зима"]
seasons_tab[4] = ["Printemps", "Été", "Automne", "Hiver"]
exports.debug = function(debug = false) {
console.log(Data);
console.log(language);
Expand All @@ -30,13 +34,15 @@ exports.language = function(lang)
switch (lang) {
case "en":
case "0":
case "EN":
case 0:
language = 0;
if (debug) {
console.log("EN")
}
break;
case "pl":
case "PL":
case "1":
case 1:
language = 1;
Expand All @@ -45,6 +51,7 @@ exports.language = function(lang)
}
break;
case "de":
case "DE":
case "2":
case 2:
language = 2;
Expand All @@ -54,6 +61,7 @@ exports.language = function(lang)
break;

case "ru":
case "RU":
case "3":
case 3:
language = 3;
Expand All @@ -62,6 +70,15 @@ exports.language = function(lang)
}
break;

case "fr":
case "FR":
case "4":
case 4:
language = 4;
if (debug) {
console.log("FR")
}
break;
default:
console.error("Language unsupported, default EN")
language = 0;
Expand Down Expand Up @@ -529,25 +546,25 @@ exports.timestampSQL_given_date = function(date)
}
exports.r0_9 = function()
{
return Math.floor(Math.random() * 10);
return crypto.randomInt(0, 9);
}
exports.r0_10 = function()
{
return Math.floor(Math.random() * 11);
return crypto.randomInt(0, 10);
}
exports.r1_10 = function()
{
return (Math.floor(Math.random() * 10) + 1);
return crypto.randomInt(1, 10);
}
exports.r0_99 = function()
{
return Math.floor(Math.random() * 100);
return crypto.randomInt(0, 99);
}
exports.r0_100 = function()
{
return Math.floor(Math.random() * 101);
return crypto.randomInt(0, 100);
}
exports.r1_100 = function()
{
return (Math.floor(Math.random() * 100) + 1)
}
return crypto.randomInt(1, 100);
}
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
{
"name": "functions-date",
"version": "0.0.3",
"version": "0.0.4",
"description": "A package with an appropriate date in an appropriate format, according to the programmer's needs.",
"main": "index.js",
"scripts": {
},
"scripts": {},
"keywords": [
"date",
"functions",
Expand Down

0 comments on commit d2383a9

Please sign in to comment.