Comparing version 1.1.0 to 1.1.1
43
app.js
@@ -167,3 +167,46 @@ const request = require('node-superfetch'); | ||
} | ||
}, | ||
süre: async function(trh) { | ||
if(!trh) throw new TypeError("Lütfen tarihi yazınız."); | ||
if (new Date(trh).getSeconds() === new Date().getSeconds()) throw new Error("Lütfen şuandan farklı bir tarih yazınız. \nSaniyenin bile farklı olmadığı tıpa tıp aynı tarihin şuanın duration haline getirebileceğim tek kısmı saniyedir ve saniyede de kesin olarak 0 yazacaktır."); | ||
const xx = new Date(trh); | ||
const x = new Date(Date.UTC(xx.getFullYear(), xx.getMonth(), xx.getDate(), xx.getHours(), xx.getMinutes(), xx.getSeconds())); | ||
const y = new Date(); | ||
const ms = y.getTime() - x.getTime(); | ||
const saniye = (y.getSeconds() - x.getSeconds() < 0) ? (x.getSeconds() - y.getSeconds()) : (y.getSeconds() - x.getSeconds()); | ||
const dakika = (y.getMinutes() - x.getMinutes() < 0) ? (x.getMinutes() - y.getMinutes()) : (y.getMinutes() - x.getMinutes()); | ||
const saat = (y.getHours() - x.getHours() < 0) ? (x.getHours() - y.getHours()) : (y.getHours() - x.getHours()); | ||
const gün = parseInt((y - x) / (24 * 60 * 1000 * 60)); | ||
const hafta = parseInt(gün / 7); | ||
const ay = parseInt(hafta / 4); | ||
const yıl = parseInt(gün / 365); | ||
let z = `${yıl} yıl ${ay} ay ${hafta} hafta ${gün} gün ${saat} saat ${dakika} dakika ${saniye} saniye önce`; | ||
if (yıl === 0 && ay === 0 && hafta === 0 && gün === 0 && saat === 0 && dakika === 0) { | ||
z = `${saniye} saniye önce`; | ||
return z | ||
} | ||
if (yıl === 0 && ay === 0 && hafta === 0 && gün === 0 && saat === 0) { | ||
z = `${dakika} dakika ${saniye} saniye önce`; | ||
return z | ||
} | ||
if (yıl === 0 && ay === 0 && hafta === 0 && gün === 0) { | ||
z = `${saat} saat ${dakika} dakika ${saniye} saniye önce`; | ||
} | ||
if (yıl === 0 && ay === 0 && hafta === 0) { | ||
z = `${gün} gün ${saat} saat ${dakika} dakika ${saniye} saniye önce`; | ||
return z | ||
} | ||
if (yıl === 0 && ay === 0) { | ||
z = `${hafta} hafta ${gün} gün ${saat} saat ${dakika} dakika ${saniye} saniye önce`; | ||
return z | ||
} | ||
if (yıl === 0) { | ||
z = `${ay} ay ${hafta} hafta ${gün} gün ${saat} saat ${dakika} dakika ${saniye} saniye önce`; | ||
return z | ||
} | ||
return z | ||
} | ||
}; |
{ | ||
"name": "croxy-api", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Gelişmiş bir Türkçe modül. Döviz, çeviri, veri kaydettirme, tarih, para birimine çevirme, dizi arama, şarkı sözü arama vb.", | ||
@@ -15,2 +15,3 @@ "main": "app.js", | ||
"veri", | ||
"süre", | ||
"kaydettirme", | ||
@@ -17,0 +18,0 @@ "çeviri", |
@@ -6,4 +6,3 @@ # CroxyApi - Gelişmiş Bir Türkçe Modül! | ||
#Yenilikler | ||
* Veritabanı sistemi eklendi. | ||
* Hatalar düzeltildi. | ||
* süre fonksiyonu eklendi. X yıl, X ay, X hafta, X gün, X dakika, X saat şeklinde girdiğiniz tarihi verir. | ||
@@ -85,4 +84,9 @@ #Dökümasyon | ||
``` | ||
# Süre | ||
```js | ||
const tarih = new Date("1 January 1970") | ||
croxy.süre(tarih) | ||
``` | ||
* Eklenecekler | ||
> Film arama sistemi |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13837
201
91