1 | import { Meridiem } from "../types.js";
|
2 | export function assignTheNextDay(component, targetDayJs) {
|
3 | targetDayJs = targetDayJs.add(1, "day");
|
4 | assignSimilarDate(component, targetDayJs);
|
5 | implySimilarTime(component, targetDayJs);
|
6 | }
|
7 | export function implyTheNextDay(component, targetDayJs) {
|
8 | targetDayJs = targetDayJs.add(1, "day");
|
9 | implySimilarDate(component, targetDayJs);
|
10 | implySimilarTime(component, targetDayJs);
|
11 | }
|
12 | export function assignSimilarDate(component, targetDayJs) {
|
13 | component.assign("day", targetDayJs.date());
|
14 | component.assign("month", targetDayJs.month() + 1);
|
15 | component.assign("year", targetDayJs.year());
|
16 | }
|
17 | export function assignSimilarTime(component, targetDayJs) {
|
18 | component.assign("hour", targetDayJs.hour());
|
19 | component.assign("minute", targetDayJs.minute());
|
20 | component.assign("second", targetDayJs.second());
|
21 | component.assign("millisecond", targetDayJs.millisecond());
|
22 | if (component.get("hour") < 12) {
|
23 | component.assign("meridiem", Meridiem.AM);
|
24 | }
|
25 | else {
|
26 | component.assign("meridiem", Meridiem.PM);
|
27 | }
|
28 | }
|
29 | export function implySimilarDate(component, targetDayJs) {
|
30 | component.imply("day", targetDayJs.date());
|
31 | component.imply("month", targetDayJs.month() + 1);
|
32 | component.imply("year", targetDayJs.year());
|
33 | }
|
34 | export function implySimilarTime(component, targetDayJs) {
|
35 | component.imply("hour", targetDayJs.hour());
|
36 | component.imply("minute", targetDayJs.minute());
|
37 | component.imply("second", targetDayJs.second());
|
38 | component.imply("millisecond", targetDayJs.millisecond());
|
39 | }
|
40 |
|
\ | No newline at end of file |