@lvce-editor/about-view 1.2.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/aboutWorkerMain.js +36 -31
- package/package.json +1 -1
package/dist/aboutWorkerMain.js
CHANGED
@@ -225,109 +225,114 @@ const inSomeYears = years => {
|
|
225
225
|
});
|
226
226
|
};
|
227
227
|
|
228
|
-
// based on https://github.com/microsoft/vscode/blob/bd782eb059e133d3a20fdb446b8feb0010a278ad/src/vs/base/common/date.ts (License MIT)
|
229
228
|
const minute = 60;
|
230
229
|
const hour = minute * 60;
|
231
230
|
const day = hour * 24;
|
232
231
|
const week = day * 7;
|
233
232
|
const month = day * 30;
|
234
233
|
const year = day * 365;
|
235
|
-
|
234
|
+
|
235
|
+
// based on https://github.com/microsoft/vscode/blob/bd782eb059e133d3a20fdb446b8feb0010a278ad/src/vs/base/common/date.ts (License MIT)
|
236
|
+
const formatDateFuture = seconds => {
|
236
237
|
if (seconds < minute) {
|
237
238
|
if (seconds === 1) {
|
238
|
-
return
|
239
|
+
return inOneSecond();
|
239
240
|
}
|
240
|
-
return
|
241
|
+
return inSomeSeconds(seconds);
|
241
242
|
}
|
242
243
|
if (seconds < hour) {
|
243
244
|
const minutes = Math.floor(seconds / minute);
|
244
245
|
if (minutes === 1) {
|
245
|
-
return
|
246
|
+
return inOneMinute();
|
246
247
|
}
|
247
|
-
return
|
248
|
+
return inSomeMinutes(minutes);
|
248
249
|
}
|
249
250
|
if (seconds < day) {
|
250
251
|
const days = Math.floor(seconds / hour);
|
251
252
|
if (days === 1) {
|
252
|
-
return
|
253
|
+
return inOneHour();
|
253
254
|
}
|
254
|
-
return
|
255
|
+
return inSomeHours(days);
|
255
256
|
}
|
256
257
|
if (seconds < week) {
|
257
258
|
const days = Math.floor(seconds / day);
|
258
259
|
if (days === 1) {
|
259
|
-
return
|
260
|
+
return inOneDay();
|
260
261
|
}
|
261
|
-
return
|
262
|
+
return inSomeDays(days);
|
262
263
|
}
|
263
264
|
if (seconds < month) {
|
264
265
|
const weeks = Math.floor(seconds / week);
|
265
266
|
if (weeks === 1) {
|
266
|
-
return
|
267
|
+
return inOneWeek();
|
267
268
|
}
|
268
|
-
return
|
269
|
+
return inSomeWeeks(weeks);
|
269
270
|
}
|
270
271
|
if (seconds < year) {
|
271
272
|
const months = Math.floor(seconds / month);
|
272
273
|
if (months === 1) {
|
273
|
-
return
|
274
|
+
return inOneMonth();
|
274
275
|
}
|
275
|
-
return
|
276
|
+
return inSomeMonths(months);
|
276
277
|
}
|
277
278
|
const years = Math.floor(seconds / year);
|
278
279
|
if (years === 1) {
|
279
|
-
return
|
280
|
+
return inOneYear();
|
280
281
|
}
|
281
|
-
return
|
282
|
+
return inSomeYears(years);
|
282
283
|
};
|
283
|
-
|
284
|
+
|
285
|
+
// based on https://github.com/microsoft/vscode/blob/bd782eb059e133d3a20fdb446b8feb0010a278ad/src/vs/base/common/date.ts (License MIT)
|
286
|
+
const formatDatePast = seconds => {
|
284
287
|
if (seconds < minute) {
|
285
288
|
if (seconds === 1) {
|
286
|
-
return
|
289
|
+
return oneSecondAgo();
|
287
290
|
}
|
288
|
-
return
|
291
|
+
return someSecondsAgo(seconds);
|
289
292
|
}
|
290
293
|
if (seconds < hour) {
|
291
294
|
const minutes = Math.floor(seconds / minute);
|
292
295
|
if (minutes === 1) {
|
293
|
-
return
|
296
|
+
return oneMinuteAgo();
|
294
297
|
}
|
295
|
-
return
|
298
|
+
return someMinutesAgo(minutes);
|
296
299
|
}
|
297
300
|
if (seconds < day) {
|
298
301
|
const days = Math.floor(seconds / hour);
|
299
302
|
if (days === 1) {
|
300
|
-
return
|
303
|
+
return oneHourAgo();
|
301
304
|
}
|
302
|
-
return
|
305
|
+
return someHoursAgo(days);
|
303
306
|
}
|
304
307
|
if (seconds < week) {
|
305
308
|
const days = Math.floor(seconds / day);
|
306
309
|
if (days === 1) {
|
307
|
-
return
|
310
|
+
return oneDayAgo();
|
308
311
|
}
|
309
|
-
return
|
312
|
+
return someDaysAgo(days);
|
310
313
|
}
|
311
314
|
if (seconds < month) {
|
312
315
|
const weeks = Math.floor(seconds / week);
|
313
316
|
if (weeks === 1) {
|
314
|
-
return
|
317
|
+
return oneWeekAgo();
|
315
318
|
}
|
316
|
-
return
|
319
|
+
return someWeeksAgo(weeks);
|
317
320
|
}
|
318
321
|
if (seconds < year) {
|
319
322
|
const months = Math.floor(seconds / month);
|
320
323
|
if (months === 1) {
|
321
|
-
return
|
324
|
+
return oneMonthAgo();
|
322
325
|
}
|
323
|
-
return
|
326
|
+
return someMonthsAgo(months);
|
324
327
|
}
|
325
328
|
const years = Math.floor(seconds / year);
|
326
329
|
if (years === 1) {
|
327
|
-
return
|
330
|
+
return oneYearAgo();
|
328
331
|
}
|
329
|
-
return
|
332
|
+
return someYearsAgo(years);
|
330
333
|
};
|
334
|
+
|
335
|
+
// based on https://github.com/microsoft/vscode/blob/bd782eb059e133d3a20fdb446b8feb0010a278ad/src/vs/base/common/date.ts (License MIT)
|
331
336
|
const formatDate = (date, now) => {
|
332
337
|
const difference = now - date;
|
333
338
|
const seconds = Math.round(difference / 1000);
|