refs #6200 style fixes, mock local date
gitea/hedera-web/pipeline/head This commit looks good Details

This commit is contained in:
Juan Ferrer 2023-10-09 21:01:11 +02:00
parent 3977b258d3
commit 4a09fe39a8
13 changed files with 56 additions and 46 deletions

2
debian/changelog vendored
View File

@ -1,4 +1,4 @@
hedera-web (23.40.2) stable; urgency=low
hedera-web (23.40.3) stable; urgency=low
* Initial Release.

View File

@ -7,8 +7,8 @@ export default new Class({
,activate() {
if (!this.hash.$.to)
this.hash.assign({
from: new Date(),
to: new Date()
from: Date.vnNew(),
to: Date.vnNew()
});
}
});

View File

@ -14,7 +14,7 @@ export default new Class({
,refreshCaptcha() {
params = {
srv: 'rest:misc/captcha',
stamp: new Date().getTime()
stamp: Date.vnNew().getTime()
};
this.$.captchaImg.src = '?'+ Vn.Url.makeUri(params);
}

View File

@ -193,16 +193,18 @@
margin-bottom: 1px;
}
& > .min-quantity {
bottom: 30px;
bottom: 32px;
right: 0;
}
}
.min-quantity {
position: absolute;
display: none;
bottom: 30px;
right: 0;
font-size: .8rem;
color: #c44;
& > span {
font-size: 16px;

View File

@ -469,10 +469,10 @@
</custom>
</htk-repeater>
<div id="card-min-quantity" class="min-quantity" title="_MinimalQuantity">
{{card.minQuantity}}
<span class="htk-icon material-symbols-rounded">
production_quantity_limits
</span>
{{card.minQuantity}}
</div>
</div>
<htk-grid class="lots-grid" show-header="false">

View File

@ -8,7 +8,7 @@ export default new Class({
this.autoStepLocked = true;
this.$.assistant.stepsIndex = this.agencySteps;
this.today = new Date();
this.today = Date.vnNew();
this.today.setHours(0, 0, 0, 0);
},
@ -22,8 +22,8 @@ export default new Class({
let date;
const row = orderForm.$ || defaultsForm.$ || {};
if (!date || date.getTime() < (new Date()).getTime()) {
date = new Date();
if (!date || date.getTime() < (Date.vnNew()).getTime()) {
date = Date.vnNew();
date.setHours(0, 0, 0, 0);
let addDays = 0;

View File

@ -6,7 +6,7 @@ export default new Class({
activate() {
this.$.lot.assign({
date: new Date(),
date: Date.vnNew(),
useIds: false
});
},

View File

@ -141,7 +141,7 @@ module.exports = new Class({
}
,goToCurrentMonth() {
var date = new Date();
var date = Date.vnNew();
this.goToMonth(date.getFullYear(), date.getMonth());
}
@ -179,7 +179,7 @@ module.exports = new Class({
// Marks the current day
var today = new Date();
var today = Date.vnNew();
if (this.year == today.getFullYear()
&& this.month == today.getMonth()) {

View File

@ -192,7 +192,7 @@ module.exports = new Class({
}
,_onFileUpload(cell) {
this._stamp = new Date().getTime();
this._stamp = Date.vnNew().getTime();
this._refreshSrc(cell);
this.popup.hide();
}

View File

@ -3,69 +3,61 @@
*/
module.exports =
{
set: function (key, value, days)
{
set: function(key, value, days) {
var strCookie = key + '=' + value + ';';
if (days != undefined)
{
var date = new Date ();
date.setTime (date.getTime () + days * 86400000);
strCookie += 'expires=' + date.toGMTString ();
if (days != undefined) {
var date = Date.vnNew();
date.setTime(date.getTime() + days * 86400000);
strCookie += 'expires=' + date.toGMTString();
}
document.cookie = strCookie;
}
,unset: function (key)
{
this.set (key, '', -1);
,unset: function(key) {
this.set(key, '', -1);
}
,get: function (key)
{
var cookie = new String (document.cookie);
var start = cookie.indexOf (key + '=');
,get: function(key) {
var cookie = new String(document.cookie);
var start = cookie.indexOf(key + '=');
if (start != -1)
{
if (start != -1) {
var end;
start += key.length + 1;
end = cookie.indexOf (';', start);
end = cookie.indexOf(';', start);
if (end > 0)
return cookie.substring (start, end);
return cookie.substring(start, end);
else
return cookie.substring (start);
return cookie.substring(start);
}
return null;
}
,getInt: function (key)
{
var value = this.get (key);
,getInt: function(key) {
var value = this.get(key);
if (value != null)
return parseInt (value);
return parseInt(value);
return null;
}
,getFloat: function (key)
{
var value = this.get (key);
,getFloat: function(key) {
var value = this.get(key);
if (value != null)
return parseFloat (value);
return parseFloat(value);
return null;
}
,check: function (key)
{
return this.get (key) != null;
,check: function(key) {
return this.get(key) != null;
}
};

View File

@ -6,6 +6,22 @@ Date.prototype.clone = function() {
return new Date(this.getTime());
}
Date.vnUTC = () => {
const env = process.env.NODE_ENV;
if (!env || env === 'development')
return new Date(Date.UTC(2001, 0, 1, 11));
return new Date();
};
Date.vnNew = () => {
return new Date(Date.vnUTC());
};
Date.vnNow = () => {
return new Date(Date.vnUTC()).getTime();
};
module.exports =
{
WDays: [

View File

@ -1,6 +1,6 @@
{
"name": "hedera-web",
"version": "23.40.2",
"version": "23.40.3",
"description": "Verdnatura web page",
"license": "GPL-3.0",
"repository": {

View File

@ -18,7 +18,7 @@ class Segment {
switch ($type) {
case Type::DATE:
$tmp = new Date();
$tmp = Date.vnNew();
$tmp->setDate(substr($v, 0, 4), substr($v, 4, 2), substr($v, 6, 2));
return $tmp;
case Type::TIME: