diff --git a/docs/css/style.css b/docs/css/style.css index dc02bd1..78049f5 100644 --- a/docs/css/style.css +++ b/docs/css/style.css @@ -1,5 +1,3 @@ - - * { box-sizing: border-box; outline: 0 @@ -50,11 +48,7 @@ html { -webkit-text-size-adjust: 100% } -button, -html, -input, -select, -textarea { +html { font-family: sans-serif } @@ -85,283 +79,38 @@ h3 { font-size: 1.17em; margin: 1em 0 } - -h4 { - font-size: 1em; - margin: 1.33em 0 -} - -h5 { - font-size: .83em; - margin: 1.67em 0 -} - -h6 { - font-size: .67em; - margin: 2.33em 0 -} - -abbr[title] { - border-bottom: 1px dotted -} - -b, -strong { - font-weight: 700 -} - -blockquote { - margin: 1em 40px -} - -dfn { - font-style: italic -} - -hr { - box-sizing: content-box; - height: 0 -} - mark { background: #ff0; color: #000 } -p, +p { + font-size: 14px; +} + pre { margin: 1em 0 } -code, -kbd, -pre, -samp { +pre { font-family: monospace, serif; font-size: 1em; + white-space: pre-wrap; + word-wrap: break-word; + background: lightgray; + padding: 5px; direction: ltr; text-align: left; } -pre { - white-space: pre-wrap; - word-wrap: break-word; - background: gray; -} - -q { - quotes: none -} - -q:after, -q:before { - content: none -} - -small { - font-size: 80% -} - -sub, -sup { - font-size: 75%; - line-height: 0; - position: relative; - vertical-align: baseline -} - -sup { - top: -.5em -} - -sub { - bottom: -.25em -} - -dl, -menu, -ol, ul { - margin: 1em 0 -} - -dd { - margin: 0 0 0 40px -} - -menu, -ol, -ul { - padding: 0 0 0 40px -} - -nav ol, -nav ul { + padding: 0; + font-size: 20px; + margin: 1em 0; list-style: none; list-style-image: none } -img { - border: 0; - -ms-interpolation-mode: bicubic -} - -svg:not(:root) { - overflow: hidden -} - -figure { - margin: 0 -} - -form { - margin: 0 -} - -fieldset { - border: 1px solid silver; - margin: 0 2px; - padding: .35em .625em .75em -} - -legend { - border: 0; - padding: 0; - white-space: normal -} - -button, -input, -select, -textarea { - font-size: 100%; - margin: 0; - vertical-align: baseline -} - -button, -input { - line-height: normal -} - -button, -select { - text-transform: none -} - -button, -html input[type=button], -input[type=reset], -input[type=submit] { - -webkit-appearance: button; - cursor: pointer -} - -button[disabled], -html input[disabled] { - cursor: default -} - -input[type=checkbox], -input[type=radio] { - box-sizing: border-box; - padding: 0 -} - -input[type=search] { - -webkit-appearance: textfield; - box-sizing: content-box -} - -input[type=search]::-webkit-search-cancel-button, -input[type=search]::-webkit-search-decoration { - -webkit-appearance: none -} - -button::-moz-focus-inner, -input::-moz-focus-inner { - border: 0; - padding: 0 -} - -textarea { - overflow: auto; - vertical-align: top -} - -table { - border-collapse: collapse; - border-spacing: 0 -} - -.text-left { - text-align: left -} - -.text-right { - text-align: right -} - -.text-center { - text-align: center -} - -.text-justify { - text-align: justify -} - -.pull-right { - float: right!important -} - -.pull-left { - float: left!important -} - -.hidden { - display: none -} - -.hide-text { - font: 0/0 a; - color: transparent; - text-shadow: none; - background-color: transparent; - border: 0 -} - -.bold, -.strong { - font-weight: 700 -} - -.italic { - font-style: italic -} - -.clearfix:after, -.clearfix:before { - display: table; - content: "" -} - -.clearfix:after { - clear: both -} - -hr { - margin-top: 27px; - margin-bottom: 27px; - border: 0; - border-top: 1px solid #ccc -} - -hr.big { - border-top: 2px solid #ddd; - margin-top: 54px; - margin-bottom: 54px -} - .container { width: 100%; max-width: 1140px; @@ -396,53 +145,13 @@ hr.big { clear: both } -.col-lg-1, -.col-lg-10, -.col-lg-11, -.col-lg-12, -.col-lg-2, .col-lg-3, -.col-lg-4, -.col-lg-5, -.col-lg-6, -.col-lg-7, -.col-lg-8, .col-lg-9, -.col-md-1, -.col-md-10, -.col-md-11, -.col-md-12, -.col-md-2, .col-md-3, -.col-md-4, -.col-md-5, -.col-md-6, -.col-md-7, -.col-md-8, .col-md-9, -.col-sm-1, -.col-sm-10, -.col-sm-11, -.col-sm-12, -.col-sm-2, .col-sm-3, -.col-sm-4, -.col-sm-5, -.col-sm-6, -.col-sm-7, -.col-sm-8, .col-sm-9, -.col-xs-1, -.col-xs-10, -.col-xs-11, -.col-xs-12, -.col-xs-2, .col-xs-3, -.col-xs-4, -.col-xs-5, -.col-xs-6, -.col-xs-7, -.col-xs-8, .col-xs-9 { position: relative; min-height: 1px; @@ -451,705 +160,62 @@ hr.big { padding-bottom: 30px } -.col-lg-1.no-padding-bottom, -.col-lg-1.no-pb, -.col-lg-10.no-padding-bottom, -.col-lg-10.no-pb, -.col-lg-11.no-padding-bottom, -.col-lg-11.no-pb, -.col-lg-12.no-padding-bottom, -.col-lg-12.no-pb, -.col-lg-2.no-padding-bottom, -.col-lg-2.no-pb, -.col-lg-3.no-padding-bottom, -.col-lg-3.no-pb, -.col-lg-4.no-padding-bottom, -.col-lg-4.no-pb, -.col-lg-5.no-padding-bottom, -.col-lg-5.no-pb, -.col-lg-6.no-padding-bottom, -.col-lg-6.no-pb, -.col-lg-7.no-padding-bottom, -.col-lg-7.no-pb, -.col-lg-8.no-padding-bottom, -.col-lg-8.no-pb, -.col-lg-9.no-padding-bottom, -.col-lg-9.no-pb, -.col-md-1.no-padding-bottom, -.col-md-1.no-pb, -.col-md-10.no-padding-bottom, -.col-md-10.no-pb, -.col-md-11.no-padding-bottom, -.col-md-11.no-pb, -.col-md-12.no-padding-bottom, -.col-md-12.no-pb, -.col-md-2.no-padding-bottom, -.col-md-2.no-pb, -.col-md-3.no-padding-bottom, -.col-md-3.no-pb, -.col-md-4.no-padding-bottom, -.col-md-4.no-pb, -.col-md-5.no-padding-bottom, -.col-md-5.no-pb, -.col-md-6.no-padding-bottom, -.col-md-6.no-pb, -.col-md-7.no-padding-bottom, -.col-md-7.no-pb, -.col-md-8.no-padding-bottom, -.col-md-8.no-pb, -.col-md-9.no-padding-bottom, -.col-md-9.no-pb, -.col-sm-1.no-padding-bottom, -.col-sm-1.no-pb, -.col-sm-10.no-padding-bottom, -.col-sm-10.no-pb, -.col-sm-11.no-padding-bottom, -.col-sm-11.no-pb, -.col-sm-12.no-padding-bottom, -.col-sm-12.no-pb, -.col-sm-2.no-padding-bottom, -.col-sm-2.no-pb, -.col-sm-3.no-padding-bottom, -.col-sm-3.no-pb, -.col-sm-4.no-padding-bottom, -.col-sm-4.no-pb, -.col-sm-5.no-padding-bottom, -.col-sm-5.no-pb, -.col-sm-6.no-padding-bottom, -.col-sm-6.no-pb, -.col-sm-7.no-padding-bottom, -.col-sm-7.no-pb, -.col-sm-8.no-padding-bottom, -.col-sm-8.no-pb, -.col-sm-9.no-padding-bottom, -.col-sm-9.no-pb, -.col-xs-1.no-padding-bottom, -.col-xs-1.no-pb, -.col-xs-10.no-padding-bottom, -.col-xs-10.no-pb, -.col-xs-11.no-padding-bottom, -.col-xs-11.no-pb, -.col-xs-12.no-padding-bottom, -.col-xs-12.no-pb, -.col-xs-2.no-padding-bottom, -.col-xs-2.no-pb, -.col-xs-3.no-padding-bottom, -.col-xs-3.no-pb, -.col-xs-4.no-padding-bottom, -.col-xs-4.no-pb, -.col-xs-5.no-padding-bottom, -.col-xs-5.no-pb, -.col-xs-6.no-padding-bottom, -.col-xs-6.no-pb, -.col-xs-7.no-padding-bottom, -.col-xs-7.no-pb, -.col-xs-8.no-padding-bottom, -.col-xs-8.no-pb, -.col-xs-9.no-padding-bottom, -.col-xs-9.no-pb { - padding-bottom: 0 -} - -.col-xs-1, -.col-xs-10, -.col-xs-11, -.col-xs-2, .col-xs-3, -.col-xs-4, -.col-xs-5, -.col-xs-6, -.col-xs-7, -.col-xs-8, .col-xs-9 { float: left } -.col-xs-1 { - width: 8.33333% -} - -.col-xs-2 { - width: 16.66667% -} - .col-xs-3 { width: 25% } -.col-xs-4 { - width: 33.33333% -} - -.col-xs-5 { - width: 41.66667% -} - -.col-xs-6 { - width: 50% -} - -.col-xs-7 { - width: 58.33333% -} - -.col-xs-8 { - width: 66.66667% -} - .col-xs-9 { width: 75% } -.col-xs-10 { - width: 83.33333% -} - -.col-xs-11 { - width: 91.66667% -} - -.col-xs-12 { - width: 100% -} - @media (min-width:768px) { - .col-sm-1 { - float: left - } - .col-sm-1 { - width: 8.33333% - } - .col-sm-push-1 { - left: 8.33333% - } - .col-sm-pull-1 { - right: 8.33333% - } - .col-sm-offset-1 { - margin-left: 8.33333% - } - .col-sm-2 { - float: left - } - .col-sm-2 { - width: 16.66667% - } - .col-sm-push-2 { - left: 16.66667% - } - .col-sm-pull-2 { - right: 16.66667% - } - .col-sm-offset-2 { - margin-left: 16.66667% - } .col-sm-3 { float: left } .col-sm-3 { width: 25% } - .col-sm-push-3 { - left: 25% - } - .col-sm-pull-3 { - right: 25% - } - .col-sm-offset-3 { - margin-left: 25% - } - .col-sm-4 { - float: left - } - .col-sm-4 { - width: 33.33333% - } - .col-sm-push-4 { - left: 33.33333% - } - .col-sm-pull-4 { - right: 33.33333% - } - .col-sm-offset-4 { - margin-left: 33.33333% - } - .col-sm-5 { - float: left - } - .col-sm-5 { - width: 41.66667% - } - .col-sm-push-5 { - left: 41.66667% - } - .col-sm-pull-5 { - right: 41.66667% - } - .col-sm-offset-5 { - margin-left: 41.66667% - } - .col-sm-6 { - float: left - } - .col-sm-6 { - width: 50% - } - .col-sm-push-6 { - left: 50% - } - .col-sm-pull-6 { - right: 50% - } - .col-sm-offset-6 { - margin-left: 50% - } - .col-sm-7 { - float: left - } - .col-sm-7 { - width: 58.33333% - } - .col-sm-push-7 { - left: 58.33333% - } - .col-sm-pull-7 { - right: 58.33333% - } - .col-sm-offset-7 { - margin-left: 58.33333% - } - .col-sm-8 { - float: left - } - .col-sm-8 { - width: 66.66667% - } - .col-sm-push-8 { - left: 66.66667% - } - .col-sm-pull-8 { - right: 66.66667% - } - .col-sm-offset-8 { - margin-left: 66.66667% - } .col-sm-9 { float: left } .col-sm-9 { width: 75% } - .col-sm-push-9 { - left: 75% - } - .col-sm-pull-9 { - right: 75% - } - .col-sm-offset-9 { - margin-left: 75% - } - .col-sm-10 { - float: left - } - .col-sm-10 { - width: 83.33333% - } - .col-sm-push-10 { - left: 83.33333% - } - .col-sm-pull-10 { - right: 83.33333% - } - .col-sm-offset-10 { - margin-left: 83.33333% - } - .col-sm-11 { - float: left - } - .col-sm-11 { - width: 91.66667% - } - .col-sm-push-11 { - left: 91.66667% - } - .col-sm-pull-11 { - right: 91.66667% - } - .col-sm-offset-11 { - margin-left: 91.66667% - } - .col-sm-push-0 { - left: auto - } - .col-sm-pull-0 { - right: auto - } - .col-sm-offset-0 { - margin-left: 0 - } - .col-sm-12 { - width: 100% - } } @media (min-width:992px) { - .col-md-1 { - float: left - } - .col-md-1 { - width: 8.33333% - } - .col-md-push-1 { - left: 8.33333% - } - .col-md-pull-1 { - right: 8.33333% - } - .col-md-offset-1 { - margin-left: 8.33333% - } - .col-md-2 { - float: left - } - .col-md-2 { - width: 16.66667% - } - .col-md-push-2 { - left: 16.66667% - } - .col-md-pull-2 { - right: 16.66667% - } - .col-md-offset-2 { - margin-left: 16.66667% - } .col-md-3 { float: left } .col-md-3 { width: 25% } - .col-md-push-3 { - left: 25% - } - .col-md-pull-3 { - right: 25% - } - .col-md-offset-3 { - margin-left: 25% - } - .col-md-4 { - float: left - } - .col-md-4 { - width: 33.33333% - } - .col-md-push-4 { - left: 33.33333% - } - .col-md-pull-4 { - right: 33.33333% - } - .col-md-offset-4 { - margin-left: 33.33333% - } - .col-md-5 { - float: left - } - .col-md-5 { - width: 41.66667% - } - .col-md-push-5 { - left: 41.66667% - } - .col-md-pull-5 { - right: 41.66667% - } - .col-md-offset-5 { - margin-left: 41.66667% - } - .col-md-6 { - float: left - } - .col-md-6 { - width: 50% - } - .col-md-push-6 { - left: 50% - } - .col-md-pull-6 { - right: 50% - } - .col-md-offset-6 { - margin-left: 50% - } - .col-md-7 { - float: left - } - .col-md-7 { - width: 58.33333% - } - .col-md-push-7 { - left: 58.33333% - } - .col-md-pull-7 { - right: 58.33333% - } - .col-md-offset-7 { - margin-left: 58.33333% - } - .col-md-8 { - float: left - } - .col-md-8 { - width: 66.66667% - } - .col-md-push-8 { - left: 66.66667% - } - .col-md-pull-8 { - right: 66.66667% - } - .col-md-offset-8 { - margin-left: 66.66667% - } .col-md-9 { float: left } .col-md-9 { width: 75% } - .col-md-push-9 { - left: 75% - } - .col-md-pull-9 { - right: 75% - } - .col-md-offset-9 { - margin-left: 75% - } - .col-md-10 { - float: left - } - .col-md-10 { - width: 83.33333% - } - .col-md-push-10 { - left: 83.33333% - } - .col-md-pull-10 { - right: 83.33333% - } - .col-md-offset-10 { - margin-left: 83.33333% - } - .col-md-11 { - float: left - } - .col-md-11 { - width: 91.66667% - } - .col-md-push-11 { - left: 91.66667% - } - .col-md-pull-11 { - right: 91.66667% - } - .col-md-offset-11 { - margin-left: 91.66667% - } - .col-md-push-0 { - left: auto - } - .col-md-pull-0 { - right: auto - } - .col-md-offset-0 { - margin-left: 0 - } - .col-md-12 { - width: 100% - } } @media (min-width:1140px) { - .col-lg-1 { - float: left - } - .col-lg-1 { - width: 8.33333% - } - .col-lg-push-1 { - left: 8.33333% - } - .col-lg-pull-1 { - right: 8.33333% - } - .col-lg-offset-1 { - margin-left: 8.33333% - } - .col-lg-2 { - float: left - } - .col-lg-2 { - width: 16.66667% - } - .col-lg-push-2 { - left: 16.66667% - } - .col-lg-pull-2 { - right: 16.66667% - } - .col-lg-offset-2 { - margin-left: 16.66667% - } .col-lg-3 { float: left } .col-lg-3 { width: 25% } - .col-lg-push-3 { - left: 25% - } - .col-lg-pull-3 { - right: 25% - } - .col-lg-offset-3 { - margin-left: 25% - } - .col-lg-4 { - float: left - } - .col-lg-4 { - width: 33.33333% - } - .col-lg-push-4 { - left: 33.33333% - } - .col-lg-pull-4 { - right: 33.33333% - } - .col-lg-offset-4 { - margin-left: 33.33333% - } - .col-lg-5 { - float: left - } - .col-lg-5 { - width: 41.66667% - } - .col-lg-push-5 { - left: 41.66667% - } - .col-lg-pull-5 { - right: 41.66667% - } - .col-lg-offset-5 { - margin-left: 41.66667% - } - .col-lg-6 { - float: left - } - .col-lg-6 { - width: 50% - } - .col-lg-push-6 { - left: 50% - } - .col-lg-pull-6 { - right: 50% - } - .col-lg-offset-6 { - margin-left: 50% - } - .col-lg-7 { - float: left - } - .col-lg-7 { - width: 58.33333% - } - .col-lg-push-7 { - left: 58.33333% - } - .col-lg-pull-7 { - right: 58.33333% - } - .col-lg-offset-7 { - margin-left: 58.33333% - } - .col-lg-8 { - float: left - } - .col-lg-8 { - width: 66.66667% - } - .col-lg-push-8 { - left: 66.66667% - } - .col-lg-pull-8 { - right: 66.66667% - } - .col-lg-offset-8 { - margin-left: 66.66667% - } .col-lg-9 { float: left } .col-lg-9 { width: 75% } - .col-lg-push-9 { - left: 75% - } - .col-lg-pull-9 { - right: 75% - } - .col-lg-offset-9 { - margin-left: 75% - } - .col-lg-10 { - float: left - } - .col-lg-10 { - width: 83.33333% - } - .col-lg-push-10 { - left: 83.33333% - } - .col-lg-pull-10 { - right: 83.33333% - } - .col-lg-offset-10 { - margin-left: 83.33333% - } - .col-lg-11 { - float: left - } - .col-lg-11 { - width: 91.66667% - } - .col-lg-push-11 { - left: 91.66667% - } - .col-lg-pull-11 { - right: 91.66667% - } - .col-lg-offset-11 { - margin-left: 91.66667% - } - .col-lg-push-0 { - left: auto - } - .col-lg-pull-0 { - right: auto - } - .col-lg-offset-0 { - margin-left: 0 - } - .col-lg-12 { - width: 100% - } } a, @@ -1160,8 +226,7 @@ a:visited { h1, h2, -h3, -h4 { +h3 { font-weight: 400; line-height: 1.4; color: #444; @@ -1173,9 +238,7 @@ h1 small, h2 .small, h2 small, h3 .small, -h3 small, -h4 .small, -h4 small { +h3 small { font-weight: 400; line-height: 1; color: #b3b3b3 @@ -1183,15 +246,13 @@ h4 small { h1 a, h2 a, -h3 a, -h4 a { +h3 a { color: #444 } h1, h2, -h3, -h4 { +h3 { margin-top: 20px; margin-bottom: 10px } @@ -1201,9 +262,7 @@ h1 small, h2 .small, h2 small, h3 .small, -h3 small, -h4 .small, -h4 small { +h3 small { font-size: 65% } @@ -1237,43 +296,38 @@ h3 { font-size: 24px } -h4 { - font-size: 20px -} - body { background: #f8f8f8; - font-family: 'Markazi Text', serif; - font-size: 15px; + font-family: SansSerif; + font-size: 14px; line-height: 27px; color: #666 } header#header { - background: #1c252c; - color: #ffd270; - font-weight: 700; + background: gray; + color: white; letter-spacing: -.04em; text-align: center; - font-size: 70px; line-height: 60px; padding: 50px 30px; margin: 0 0 30px 0 } header#header h1 { - color: #ffd270; + color: white; + font-family: "Sans"; + font-weight: 700; font-size: 70px; line-height: 90px; - font-weight: 700 } header#header h1::after { - background: rgba(255, 210, 112, .75) + background: white; } header#header h2 { - color: rgba(255, 210, 112, .5) + color: lightgray; } footer#footer { @@ -1283,6 +337,22 @@ footer#footer { margin-top: 30px } +#go_top { + display: none; + position: fixed; + bottom: 20px; + right: 30px; + z-index: 99; + font-size: 18px; + border: none; + outline: none; + background-color: red; + color: white; + cursor: pointer; + padding: 15px; + border-radius: 4px; +} + footer#footer a, footer#footer a:visited { color: #888 @@ -1294,28 +364,6 @@ label { margin-bottom: 5px } -p.help { - color: #999 -} - -#toggleDropify { - font-size: 12px; - text-transform: uppercase; - background: #ddd; - color: #888; - font-weight: 700; - border: 0; - padding: 6px 10px; - border-radius: 4px; - margin-left: 10px; - -webkit-transition: background .1s linear; - transition: background .1s linear -} - -#toggleDropify:hover { - background: #eee -} - @media (max-width:480px) { header#header { padding: 30px 15px diff --git a/docs/en/index.html b/docs/en/index.html new file mode 100644 index 0000000..5c61629 --- /dev/null +++ b/docs/en/index.html @@ -0,0 +1,591 @@ + + + + Verta — Laravel plugin Jalali datetime + + + + + + + + +Fork me on GitHub + + +
+
+
+ +
+
+
+

Installation

+

Enter the following command to install Verta

+
$ composer require hekmatinasser/verta
+

Now you have to add the package to your project by entering the following command

+ +
// config/app.php
+'providers' => [
+    ...
+    Hekmatinasser\Verta\VertaServiceProvider::class,
+],
+
+'alias' => [
+    ...
+    'Verta' => Hekmatinasser\Verta\Verta::class,
+]
+

Usage

+

Use the following command at the top of each file of the use Verta class

+
+use Verta;
+// or
+use Hekmatinasser\Verta\Verta;
+
+

Creator

+

To get the current datetime, use the following command

+
+$v = new Verta(); //1396-02-02 15:32:08
+$v = verta(); //1396-02-02 15:32:08
+
+

To get the current date and time, use the following command

+
+$v = Verta::now(); //1396-02-02 15:32:08
+$v = Verta::today(); //1396-03-02 00:00:00
+$v = Verta::tomorrow(); // 1396-03-03 00:00:00
+$v = Verta::yesterday(); // 1396-03-01 00:00:00
+
+ +

To convert your Gregorian datetime, use the following command

+
+$v = new Verta('2016-12-27 14:12:32');
+$v = Verta::instance('2016-12-25 11:12:36');
+$v = Facades\Verta::instance('2016-12-25 11:12:36');
+
+

To use the timestamp number, use the following command

+
+$v = new Verta(1333857600);
+
+

To use the Datetime class PHP, use the following command

+
+$dt = new \Datetime();
+return new Verta($dt); // 1395-12-09 15:05:56
+
+

To use the Carbon class, use the following command

+
+$c = \Carbon::now();
+return verta($c); // 1395-12-09 15:05:56
+
+

To use the jalali datetime as a string, use the following command

+
+$v = Verta::parse('1395-10-07 14:12:32');
+$v = Verta::parse('1396 مهر 17');
+$v =  Verta::parseFormat('Y n j','1396 مهر 17');
+
+ +

If the date values are separate, use the following commands

+
+return Verta::create();  // 1395-12-14 11:17:01 equal now()
+return Verta::create(2016,12,25,15,20,15);  // 1395-10-05 15:20:15
+return Verta::createDate(2016,12,25); // 1395-10-05 21:35:49 set time now
+return Verta::createTime(15,51,5); // 1396-02-31 15:51:05 set date now
+
+// alias create functions
+return Verta::createGregorian(2016,12,25,15,20,15);  // 1395-10-05 15:20:15
+return Verta::createGregorianDate(2016,12,25); // 1395-10-05 21:35:49 set time now
+return Verta::createGregorianTime(15,51,5); // 1396-02-31 15:51:05 set date now
+
+

To use the timestamp numeric, use the following command

+
+return Verta::createTimestamp(1488614023); // 1395-12-14 11:23:43
+
+

If the date jalali values are separate, use the following commands

+
+// get Jalali datetime
+return Verta::createJalali(1394,12,29,15,51,5);  // 1394-12-29 15:51:05
+return Verta::createJalaliDate(1394,12,29); // 1394-12-29 11:18:29 set time now
+return Verta::createJalaliTime(15,51,5); // 1395-12-14 15:51:05 set date now
+
+

Transformations

+

Gregorian to Jalali date, use the following command

+
+return Verta::getJalali(2015,12,25); // [1394,10,4]
+
+

Jalali to Gregorian date, use the following command

+
+return Verta::getGregorian(1394,10,4); // [2015,12,25]
+
+

Verta to Datatime PHP, use the following command

+
+$dt = verta()->DateTime();
+
+

Verta to Carbon, use the following command

+
+$c = Carbon::instance($v->DateTime());
+
+

Property

+

To get property, use the following command

+
+$v = verta(); // 1396-03-14 14:18:23
+return $v->year; // 1396
+return $v->quarter // 1
+return $v->month; // 3
+return $v->day; // 14
+return $v->hour; // 14
+return $v->minute; // 18
+return $v->second; // 23
+return $v->micro; // 0
+return $v->dayOfWeek; // 1
+return $v->dayOfYear; // 107
+return $v->weekOfYear; // 16
+return $v->daysInMonth; // 31
+return $v->timestamp; // 1496557661
+return $v->timezone; // Asia/Tehran
+
+

To set property, use the following command

+
+$v = verta();
+$v->year = 1395;
+$v->month = 4; // set 13 for next year first month
+$v->day = 25;
+$v->hour = 16;
+$v->minute = 50;
+$v->second = 42;
+$v->timestamp = 1496557661;
+$v->timezone = 'Asia/Baku';
+
+

To set property with method, use the following command

+
+$v = $v->year(1395);
+$v = $v->month(4); // set 13 for next year first month
+$v = $v->day(25);
+$v = $v->hour(16);
+$v = $v->minute(50);
+$v = $v->second(42);
+$v = $v->timestamp(1496557661);
+$v = $v->timezone('Asia/Baku');
+
+

To set property together, use the following command

+
+$v = $v->setDateTime(1395, 4, 25, 16, 50, 42);
+$v = $v->setDateTime(1395, 4, 25, 16, 50, 42, 1569856);
+$v = $v->setDate(1395, 4, 25);
+$v = $v->setTimeString('12:25:48');
+
+

Format

+

To output format, use the following command

+
+$v = verta();
+return $v->format('Y-n-j H:i'); // 1395-10-7 14:12
+return $v->format('%B %d، %Y'); // دی 07، 1395
+return $v; //1395-10-07 14:12:32
+
+

Read the PHP manual to create the format you want

+

+ strftime + date +

+

To default output format, use the following command

+
+Verta::setStringformat('Y/n/j H:i:s');
+return verta(); // 1395/12/12 00:11:35
+
+

To reset output format, use the following command

+
+Verta::resetStringFormat();
+return verta(); // 1395-12-12 00:18:04
+
+

To display the datetime in standard formats, use the following command

+
+return $v->formatDatetime(); // 1395-12-10 23:37:26
+return $v->formatDate(); // 1395-12-10
+return $v->formatTime(); // 23:26:35
+return $v->formatJalaliDatetime(); // 1395/12/10 23:46:09
+return $v->formatJalaliDate(); // 1395/12/10
+
+

To output format Gregorian, use the following command

+
+return $v->formatGregorian('Y-m-d H:i:s'); // 2017-05-23 23:21:02
+
+

To display the date difference as a unit of time, use the following command

+

If you do set parameter, the difference is calculated with the current time

+
+return $v1->formatDifference($v2); // 12 ماه بعد
+return $v1->formatDifference($v3); // 1 سال قبل
+return $v1->addDays(25)->formatDifference(); // 4 هفته بعد
+return $v1->subDays(6)->formatDifference(); // 6 روز قبل
+return verta()->formatDifference(); // الان
+
+

To display numbers in alphabetical order, use the following command

+
+return $v->formatWord('Y'); // یک هزار و سیصد و نود و شش
+return $v->formatWord('l dS F'); // چهارشنبه بیست و نه ام شهریور
+return $v->formatWord('d F Y'); // بیست و نه شهریور یک هزار و سیصد و نود و شش
+return $v->formatWord('r'); // چهارشنبه یک هزار و سیصد و نود و شش, شش, بیست و نه, بیست و دو:چهل و نه:سی و هشت +04:30
+return $v->formatWord('d F ') . $v->year; // بیست و نه شهریور 1396
+
+

Modification

+

To add or sub datetime, use the following command

+
+$v = verta();
+return $v->addYear(); // 1396-10-07 14:12:32
+return $v->addYears(4); // 1399-10-07 14:12:32
+return $v->subYear(); // 1394-10-07 14:12:32
+return $v->subYears(2); // 1393-10-07 14:12:32
+
+
+return $v->addMonth(); // 1395-11-07 14:12:32
+return $v->addMonths(5); // 1396-03-07 14:12:32
+return $v->subMonth(); // 1395-09-07 14:12:32
+return $v->subMonths(2); // 1395-08-07 14:12:32
+
+
+return $v->addWeek(); // 1395-10-12 14:12:32
+return $v->addWeeks(3); // 1395-10-26 14:12:32
+return $v->subWeek(); // 1395-09-30 14:12:32
+return $v->subWeeks(2); // 1395-09-27 14:12:32
+
+
+return $v->addDay(); // 1395-10-08 14:12:32
+return $v->addDays(3); // 1395-10-11 14:12:32
+return $v->subDay(); // 1395-10-06 14:12:32
+return $v->subDays(2); // 1395-09-05 14:12:32
+
+
+return $v->addHour(); // 1395-10-07 15:12:32
+return $v->addHours(5); // 1395-10-07 19:12:32
+return $v->subHour(); // 1395-10-07 13:12:32
+return $v->subHours(2); // 1395-10-07 12:12:32
+
+
+return $v->addMinute(); // 1395-10-07 14:13:32
+return $v->addMinutes(3); // 1395-10-07 14:15:32
+return $v->subMinute(); // 1395-10-07 14:11:32
+return $v->subMinutes(2); // 1395-10-07 14:10:32
+
+
+return $v->addSecond(); // 1395-10-07 14:12:33
+return $v->addSeconds(3); // 1395-10-07 14:12:35
+return $v->subSecond(); // 1395-10-07 14:12:31
+return $v->subSeconds(2); // 1395-10-07 14:12:30
+
+

To get start or end datetime period, use the following command

+
+$v = verta(); // 1396-04-29 14:25:48
+return $v->startDay(); // 1396-04-29 00:00:00
+return $v->endDay(); // 1396-04-29 23:59:59
+
+
+return $v->startWeek(); // 1396 1396-04-24 00:00:00
+return $v->endWeek(); // 1396-04-30 23:59:59
+
+
+return $v->startMonth(); // 1396-04-01 00:00:00
+return $v->endMonth(); // 1396-04-31 00:00:00
+
+
+return $v->startQuarter(); // 1396-04-01 00:00:00
+return $v->endQuarter(); // 1396-06-31 23:59:59
+
+
+return $v->startYear(); // 1396-01-01 00:00:00
+return $v->endYear(); // 1396-12-29 23:59:59
+
+

Comparison

+

To validate datetime, use the following command

+
+return Verta::isLeapYear(1394); // false
+return Verta::isValideDate(1394, 12, 30); // false
+return Verta::isValideTime(15, 12, 30); // true
+
+

To difference datetime together, use the following command

+
+// diff objects together
+$v1 = verta(); // 1396-03-31 22:21:40
+$v2 = verta('2017-06-21 01:21:40'); // 1396-03-31 01:21:40
+$v3 = verta('2017-06-20'); // 1396-03-30 15:24:53
+
+return $v1->diffYears($v3); // -1
+return $v1->diffMonths($v2); // 11
+return $v2->diffMonths(); // -11 compare with now
+return $v1->diffWeeks($v2); // 51
+return $v1->diffDays($v3); // -372
+return $v3->diffMinutes(); // 536548
+return $v3->diffSeconds(); // 12261931
+
+

To compere datetime together, use the following command

+
+return $v1->eq(); // ture alias equalTo()
+return $v1->ne($v2); // true alias notEqualTo()
+return $v1->gt($v2); // true alias greaterThan()
+return $v1->gte($v2); // true alias greaterThanOrEqualTo()
+return $v1->lt($v2); // false alias lessThan()
+return $v1->lte($v2); // false alias lessThanOrEqualTo()
+return $v1->between($v2, $v3); // false    
+
+

To compere datetime for closest, farthest, min or max together, use the following command

+
+return $v1->closest($v2, $v3); // return $v2 object
+return $v1->farthest($v2, $v3); // return $v3 object
+return $v1->minimum($v2); // return $v2
+return $v1->min($v2); // return $v2
+return $v1->maximum($v2); // return $v1
+return $v1->max($v2); // return $v1
+
+

To compere datetime now, use the following command

+
+return $v1->isWeekday(); // true
+return $v1->isWeekend(); // false
+return $v1->isYesterday(); // false
+return $v1->isToday(); // true
+return $v1->isTomorrow(); // false
+return $v1->isNextWeek(); // false
+return $v1->isLastWeek(); // false
+return $v1->isNextMonth(); // false
+return $v1->isLastMonth(); // false
+return $v1->isNextYear(); // false
+return $v1->isLastYear(); // false
+return $v1->isFuture(); // false
+return $v1->isPast(); // false
+return $v1->isPast(); // false
+
+return $v1->isCurrentYear(); // true
+return $v1->isSameAs('y', $v2); // true isSameYear()
+return $v1->isCurrentMonth(); // true
+return $v1->isSameMonth($v2); // true
+return $v1->isSameDay($v2); // true
+return $v1->isBirthday(); // true compare with today
+return $v1->isBirthday($v2); // true
+
+return $v1->isSaturday(); // false
+return $v1->isSunday(); // false
+return $v1->isMonday(); // false
+return $v1->isTuesday(); // false
+return $v1->isWednesday(); // false
+return $v1->isThursday(); // true
+return $v1->isFriday(); // false
+
+

Laravel Validator

+

You can validate form with Validator Laravel

+

You need to define error messages for jdate, ... rules in validation.php in lang folders.

+
+'jdate' => 'The :attribute is not valid Jalali date',
+'jdate_equal' => 'The :attribute is not equal Jalali date  :date',
+'jdate_not_equal' => 'The :attribute is\'nt not equal Jalali date  :date',
+'jdatetime' => 'The :attribute is not valid Jalali datetime',
+'jdatetime_equal' => 'The :attribute is not equal Jalali datetime :date',
+'jdatetime_not_equal' => 'The :attribute is\'nt not equal Jalali datetime :date',
+'jdate_after' => 'The :attribute must be a Jalali date after :date.',
+'jdate_after_equal' => 'The :attribute must be a Jalali date after or equal :date.',
+'jdatetime_after' => 'The :attribute must be a Jalali datetime after :date.',
+'jdatetime_after_equal' => 'The :attribute must be a Jalali datetime after or equal :date.',
+'jdate_before' => 'The :attribute must be a Jalali date before :date.',
+'jdate_before_equal' => 'The :attribute must be a Jalali date before or equal :date.',
+'jdatetime_before' => 'The :attribute must be a Jalali datetime before :date.',
+'jdatetime_before_equal' => 'The :attribute must be a Jalali datetime before or equal :date.',
+
+'attributes' => [
+    'start_date' => 'start date',
+    'expire_datetime' => 'expire datetime',
+],
+
+

Validation Rules

+

Determines if an input is a valid Jalali date with the specified format

+

The default format is Y/m/d

+
+'start_date' => 'jdate'
+'start_date' => 'jdate:Y/m/d'
+
+

Determines if an input is a valid Jalali date with the specified format and it is equal a given date

+

The default format is Y/m/d

+ +
+'start_date' => 'jdate_equal'
+'start_date' => 'jdate_equal:1388/01/01'
+'start_date' => 'jdate_equal:1388/01/01,Y/m/d'
+
+ +

Determines if an input is a valid Jalali date with the specified format and it is not equal a given date

+

The default format is Y/m/d

+ +
+'start_date' => 'jdate_not_equal'
+'start_date' => 'jdate_not_equal:1388/01/01'
+'start_date' => 'jdate_not_equal:1388/01/01,Y/m/d'
+
+

Determines if an input is a valid Jalali datetime with the specified format

+

The default format is Y/m/d H:i:s

+
+'start_date' => 'jdatetime'
+'start_date' => 'jdatetime:Y/m/d H:i:s'
+
+

Determines if an input is a valid Jalali datetime with the specified format and it is equal a given datetime

+

The default format is Y/m/d H:i:s

+
+'start_date' => 'jdatetime_equal'
+'start_date' => 'jdatetime_equal:1388/01/01 12:56:28'
+'start_date' => 'jdatetime_equal:1388/01/01 12:56:28,Y/m/d H:i:s'
+
+

Determines if an input is a valid Jalali datetime with the specified format and it is not equal a given datetime

+

The default format is Y/m/d H:i:s

+
+'start_date' => 'jdatetime_not_equal'
+'start_date' => 'jdatetime_not_equal:1388/01/01 12:56:28'
+'start_date' => 'jdatetime_not_equal:1388/01/01 12:56:28,Y/m/d H:i:s'
+
+ +

Determines if an input is a valid Jalali date with the specified format and it is after a given date

+

The default date is now

+

The default format is Y/m/d

+
+'start_date' => 'jdate_after'
+'start_date' => 'jdate_after:1388/01/01'
+'start_date' => 'jdate_after:1388/01/01,Y/m/d'
+
+

Determines if an input is a valid Jalali datetime with the specified format and it is after or equal a given datetime

+

The default date is now

+

The default format is Y/m/d

+
+'start_date' => 'jdate_after_equal'
+'start_date' => 'jdate_after_equal:1388/01/01'
+'start_date' => 'jdate_after_equal:1388/01/01,Y/m/d'
+
+

Determines if an input is a valid Jalali datetime with the specified format and it is after a given datetime

+

The default date is now

+

The default format is Y/m/d H:i:s

+
+'start_date' => 'jdatetime_after'
+'start_date' => 'jdatetime_after:1388/01/01'
+'start_date' => 'jdatetime_after:1388/01/01,Y/m/d'
+
+

Determines if an input is a valid Jalali datetime with the specified format and it is after or equal a given datetime

+

The default date is now

+

The default format is Y/m/d H:i:s

+
+'start_date' => 'jdatetime_after_equal'
+'start_date' => 'jdatetime_after_equal:1388/01/01'
+'start_date' => 'jdatetime_after_equal:1388/01/01,Y/m/d'
+
+ +

Determines if an input is a valid Jalali date with the specified format and it is before a given date

+

The default date is now

+

The default format is Y/m/d

+
+'start_date' => 'jdate_before'
+'start_date' => 'jdate_before:1388/01/01'
+'start_date' => 'jdate_before:1388/01/01,Y/m/d'
+
+

Determines if an input is a valid Jalali date with the specified format and it is before or equal a given date

+

The default date is now

+

The default format is Y/m/d

+
+'start_date' => 'jdate_before_equal'
+'start_date' => 'jdate_before_equal:1388/01/01'
+'start_date' => 'jdate_before_equal:1388/01/01,Y/m/d'
+
+

Determines if an input is a valid Jalali datetime with the specified format and it is before a given date-time

+

The default date is now

+

The default format is Y/m/d H:i:s

+
+'start_date' => 'jdatetime_before'
+'start_date' => 'jdatetime_before:1388/01/01'
+'start_date' => 'jdatetime_before:1388/01/01,Y/m/d'
+
+

Determines if an input is a valid Jalali datetime with the specified format and it is before or equal a given datetime

+

The default date is now

+

The default format is Y/m/d H:i:s

+
+'start_date' => 'jdatetime_before_equal'
+'start_date' => 'jdatetime_before_equal:1388/01/01'
+'start_date' => 'jdatetime_before_equal:1388/01/01,Y/m/d'
+
+

Can combine the rules of the between the two boundaries

+
+$validate = Validator::make([
+    'start_date' => '1389/01/31',
+    'expire_datetime' => '1397/02/16 12:10:00',
+],
+[
+    'start_date' => 'required|jdate:Y/m/d|jdate_after:1388/01/01,Y/m/d|jdate_before:1390/01/01',
+    'expire_datetime' => 'required|jdatetime|jdatetime_after:1397/02/16 12:09:50,Y/m/d H:i:s|jdatetime_before:1397/02/16 12:11:00',
+]);
+
+if ($validate->fails()) {
+    dd($validate->messages()->toArray());
+}
+
+    //output
+array:2 [
+  "start_date" => array:1 [
+    0 => "The start date must be a Jalali date before 1390/01/01."
+  ]
+  "expire_datetime" => array:1 [
+    0 => "The expire datetime must be a Jalali datetime before 1397/02/16 12:10:00."
+  ]
+]
+
+
+
+
+
+ + + + + + diff --git a/docs/index.html b/docs/index.html index a98450c..3cf0c2c 100644 --- a/docs/index.html +++ b/docs/index.html @@ -20,7 +20,6 @@
-

فهرست

  • نصب @@ -41,7 +40,7 @@ قالب نمایش
  • - تغییر دادن + تغییر دادن
  • بررسی و مقایسه @@ -257,7 +256,7 @@ return $v->formatWord('d F Y'); // بیست و نه شهریور یک هزار return $v->formatWord('r'); // چهارشنبه یک هزار و سیصد و نود و شش, شش, بیست و نه, بیست و دو:چهل و نه:سی و هشت +04:30 return $v->formatWord('d F ') . $v->year; // بیست و نه شهریور 1396 -

    تغییر دادن

    +

    تغییر دادن

    برای اضافه یا کم کردن از تاریخ خود، از دستور زیر استفاده کنید

     $v = verta();
    @@ -573,7 +572,7 @@ array:2 [
         
- +